PRB: Cannot Trap for Error #1739 (142287)
The information in this article applies to:
- Microsoft Visual FoxPro for Windows 3.0
- Microsoft Visual FoxPro for Windows 3.0b
This article was previously published under Q142287 SYMPTOMS
Changing a property of a Cursor or Relational Object correctly initiates
error #1739 "Property setting will not take effect until data environment
reloaded." Unfortunately, the error cannot be trapped with an Error Event
nor an ON ERROR command.
WORKAROUND
Avoid any possibility of getting the error. Always unload the Data
Environment before changing the property. To unload the Data Environment,
use the following steps to initiate the CloseTables method of the Data
Environment:
- Create a new property of the form called "DataLoad" with an initial
value of False (.F.).
- Inside the OpenTables method, include the following code:
THISFORM.DataLoad=.T.
- Inside the CloseTables method, include the following code:
THISFORM.DataLoad=.F.
- Use the DataLoad flag to check to see if the Data Environment has been
loaded and act accordingly. In the following code, the Data Environment
is unloaded before the Cursor property is changed. The code can be
located inside any method or event of the form.
IF THISFORM.DataLoad
THISFORM.DataEnvironment.CloseTables
ENDIF
THISFORM.DataEnvironment.Cursor1.ALIAS="FOX"
The DataLoad flag is used to determine if the data environment has been
loaded because the CloseTables method will generate an error if the Data
Environment had not first been loaded with the OpenTables method.
OpenTables is called initially if AutoOpenTables is True (.T.).
STATUS
Microsoft is researching this behavior and will post new information here
in the Microsoft Knowledge Base as it becomes available.
Modification Type: | Major | Last Reviewed: | 9/30/2003 |
---|
Keywords: | KB142287 |
---|
|