Your code will work fine if you just declare llError first:
LOCAL llError
llError = .F.
I do exactly this in my DB_EXCL function. If you want to compare code, you can download DB_EXCL from
www.peisch.com/downloads.html.
>Hi,
> I have a function in prg file. It responsible to loop thru all tables of opened database and USE it exclusively. It any of them failed, it will return .F.
> I place
ON ERROR llError = .T.
before I try to
USE mytable EXCLUSIVE
>
> I have declare
LOCAL llError
My problem is, llError always is epual to .F. I found that ON ERROR will create llError as public and refer to it instead of my local llerror. Why?
>
> To continue my work, I remove my statement LOCAL llError from the procedure. It works fine if I call it from command window. However, once I call this function from form.method, form.error() will be fired everytime if USE failed. How could I force VFP to not use ON ERROR to handle error instead of FORM.error()?
>
>Thank you