How can i search records using filters? combining a option group and a textbox. If a have a form then there is an option group to select for a field then i have a text box use to input the text to search. how can i make this happend please help me!
* Add a new form property called .DataToFind
* Add a new grid, grdTABLE, .RecordSource being TABLE you want to search
* Place this code in the KeyPress event of the textbox
* You will need to decide what filter expression is appropriate, determined by your OptionGroup.
* As you type in your string, the number of records shown in .grdTABLE will reduce until you can see the one you want.
IF LASTKEY() = 3 OR ;
[tab][tab]LASTKEY() = 5 OR ;
[tab][tab]LASTKEY() = 9 OR ;
[tab][tab]LASTKEY() = 15 OR ;
[tab][tab]LASTKEY() = 24 OR ;
[tab][tab]LASTKEY() = 27
[tab]MESSAGEBOX([You have pressed the wrong key] ,;
[tab][tab]0 + 48 + 0 ,;
[tab][tab][Invalid keypress])
ELSE
[tab]SELE TABLE
[tab]THISFORM.DataToFind = ALLT(THIS.Value)+ CHR(nkeyCode)
[tab]SET FILTER TO ;
[tab][tab]UPPER(THISFORM.DataToFind) $ UPPER(TABLE.field_1) OR ;
[tab][tab]UPPER(THISFORM.DataToFind) $ UPPER(TABLE.field_2) OR ;
[tab][tab]UPPER(THISFORM.DataToFind) $ UPPER(TABLE.field_3) OR ;
[tab][tab]UPPER(THISFORM.DataToFind) $ UPPER(TABLE.field_4) OR ;
[tab][tab]UPPER(THISFORM.DataToFind) $ UPPER(TABLE.field_5)
[tab]THISFORM.grdTABLE.Refresh()
ENDIF
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.