>Hi,
>I have command button on a form, the click event will call a user define function to run something. But in the function will access a properties on the form.
>
>For example
>
>
>function check_count()
>ncnt = thisform.count
>....
>Return .t.
>
>
>I got an error said that thisform only use in METHOD.
>
>How can I solve it ?
>Please advise
>Derek
Tamar gives you the best solution. But if you already have many forms and want to use this function in all of them, you have two other chioses:
1. Use _SCREEN.ActiveForm
function check_count()
LOCAL ncnt
ncnt = 0
IF VARTYPE(_SCREEN.ActiveForm) == "O"
IF PEMSTATUS(_SCREEN.ActiveForm.count,5)
ncnt = _SCREEN.ActiveForm.count
ENDIF
ENDIF
....
Return .t.
2. Other way is to poass a reference of the for to Function
Somwhere in the form:
check_count(...,thisform)
function check_count(...,oForm)
LOCAL ncnt
ncnt = 0
IF VARTYPE(oForm) == "O"
IF PEMSTATUS(oForm.count,5)
ncnt = oForm.count
ENDIF
ENDIF
....
Return .t.
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.