honey1016


why my Search button is not go to the correct records but it will go with one records again and again this is my sample program in Search Button. Please correct my program. Thank you

****** sample******

public v_recno


sele pds_data
set order to tin

flag = 0


IF EMPTY(thisform.txtTin.value)
thisform.txtTin.setfocus
flag=1
ELSE
IF !EMPTY(thisform.txtTin.value)
SEEK ALLTRIM(thisform.txtTin.value)

ENDIF
ENDIF

IF FOUND()
v_recno = recno()
thisform.hide
do form 'data_entry.scx'
thisform.txtTin.value=" "

ELSE
IF flag = 1
=MESSAGEBOX("Enter value for 'TIN'.",16,"Invalid Input")
else
=messagebox("Sorry, The Record Does Not Exist.",16,"Search Failed")
thisform.txtTin.value=" "
thisform.txtTin.setfocus
ENDIF
ENDIF
thisform.refresh





Re: Search Button

CChalom


I've organized your code a little bit.. Check if it helps.

public v_recno


sele pds_data
set order to tin

flag = 0


IF EMPTY(thisform.txtTin.value)
flag=1
thisform.txtTin.setfocus
RETURN

ENDIF

SEEK ALLTRIM(thisform.txtTin.value)
IF NOT EOF()
v_recno = recno()
Thisform.hide
DO FORM 'data_entry.scx'
Thisform.txtTin.value=" "

ELSE
IF flag = 1
=MESSAGEBOX("Enter value for 'TIN'.",16,"Invalid Input")
ELSE
=MESSAGEBOX("Sorry, The Record Does Not Exist.",16,"Search Failed")
Thisform.txtTin.Value=" "
Thisform.txtTin.SetFocus
ENDIF
ENDIF

Thisform.Refresh

Make sure that your form Data_Entry.SCX is MODAL.