PichiMedia
Programmer
I am using VFP8. I have a table called CLIENTS with 2 fields, one is called CLIENT_NAME(character) and the other one is called VALUE(numeric). I have a simple form, on which I dragged a text field (TEXT1), and a combo box (COMBO1). I've inserted the CLIENTS table at the DATA INVOIREMENT window, so this table has been added there. I've linked the combo box to the CLIENTS table, on CLIENT_NAME field, so when I click on the combo, I can see all the clients name from the table. What I want to do is a quick search procedure, whenever I type a letter in the text field TEXT1, the combo box to show the clients with that letter. I trid to add a SET FILTER TO command in the INTERACTIVE CHANGE on TEXT1:
SET FILTER TO ALLTRIM(THISFORM.TEXT1.VALUE)=SUBSTR(CLIENT_NAME,1,LEN(ALLTRIM(THISFORM.TEXT1.VALUE)))
GO TOP
THISFORM.REFRESH
This works, I mean, I type in the TEXT1 the letter C, and the combo box shows me CURT, which is what I want it to do. But if I try to click on the combo box I get this error:
THISFORM CAN ONLY BE USED WITHIN A METHOD
I press OK on this error, and then it works again, I type another letter in the TEXT1 and the combo box shows the name that starts with that particular letter, but again, if i try to click on the combo I get the same error. Is there a way to eliminate this? I read the help section, because the error window provides a HELP button and it says I have to use a METHOD. I'm really new to VFP, please can anyone help me? Thank you very much.
SET FILTER TO ALLTRIM(THISFORM.TEXT1.VALUE)=SUBSTR(CLIENT_NAME,1,LEN(ALLTRIM(THISFORM.TEXT1.VALUE)))
GO TOP
THISFORM.REFRESH
This works, I mean, I type in the TEXT1 the letter C, and the combo box shows me CURT, which is what I want it to do. But if I try to click on the combo box I get this error:
THISFORM CAN ONLY BE USED WITHIN A METHOD
I press OK on this error, and then it works again, I type another letter in the TEXT1 and the combo box shows the name that starts with that particular letter, but again, if i try to click on the combo I get the same error. Is there a way to eliminate this? I read the help section, because the error window provides a HELP button and it says I have to use a METHOD. I'm really new to VFP, please can anyone help me? Thank you very much.