I have a grid on a form populated by a view. I added a button to filter the data.
cFilter = UPPER(ALLTRIM(INPUTBOX("Filter sur :","Spectech France - Suivi DDP")))
SELECT vwDdp_all
LOCATE FOR ALLTRIM(ref_client) = cFilter
IF FOUND()
SET FILTER TO ref_client = cFilter
THISFORM.grdDDP.Column10.SetFocus
ENDIF
I get a "Variable cFilter not found" error. What I don't understand is that the error comes after the above code has already run; and in the debugger, the guilty method is indicated as "MyForm.grdDDP". Nothing else. How can I find where it's actually looking for this variable?
The variable cFilter would have to be a global for your code to work.
If you don't want to use a global variable, you can do something like this.
cFilter = UPPER(ALLTRIM(INPUTBOX("Filter sur :","Spectech France - Suivi DDP")))
SELECT vwDdp_all
LOCATE FOR ALLTRIM(ref_client) = cFilter
IF FOUND()
lcFiltClause = [ref_client = ']+cFilter+[']
SET FILTER TO &lcFiltClause
THISFORM.grdDDP.Column10.SetFocus
ENDIF