Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to avoid error for undefined var with TEXTMERGE?
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00633781
Message ID:
00634474
Views:
17
>>Hi Eric.
>>
>>>My problem is that, if there is an error in the file, specifically the lname variable is not defined, the TEXTMERGE gives an error. Is there a way to make it work like the TEXT...ENDTEXT command that just put nothing in the replacement in this case but don't produce any error?
>>
>>How about having your error handler just RETURN if the error occurs while using TEXTMERGE()? I do that using code like:
This.lTextMerge = .T.
>>textmerge(whatever)
>>This.lTextMerge = .F.
>>
>>function Error...
>>if This.lTextMerge
>>  return
>>else
>>  rest of code
>>endif
Doug
>
>Many thanks Doug. Most of the time the solution is so simple!

In the case of missing variables the line
lcResult = textmerge(whatever)
will be skipped and variable lcResult wouldn't be changed.
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform