PRB: Data Environment Stores Paths as Relative Paths
ID: Q229779
|
The information in this article applies to:
-
Microsoft Visual FoxPro for Windows, versions 3.0, 3.0b, 5.0, 5.0a, 6.0
SYMPTOMS
If you develop a form with one or more tables in the data environment and the table in the data environment is on the same drive as the Visual FoxPro form, when the form is deployed to computers, the data environment looks on the local drive for the table, resulting in the following error:
Error instantiating cursor object. Could not find (table file name).
CAUSE
The data environment stores the path to the table as a relative path. For example, if a table used in the data environment is located in "F:\MyData" and the form is located in "F:\MyData\Forms," Visual FoxPro stores the path as "..\MyTable.Dbf" instead of storing the path as "F:\MyData\MyTable.Dbf." When a relative path is stored, Visual FoxPro looks for the table on the drive that the form is run from.
RESOLUTION
There are two possible resolutions for this problem.
- The first is to manually edit the SCX file. To do this, use the following steps:
- Use the SCX file as a table, making sure to include the SCX extension. For instance, USE MyForm.Scx.
- Browse the SCX file. Double-click on the Class memo field and position the memo field window and the browse window so that both are visible.
- Scroll through the records in the browse window until the memo field window displays "cursor" (without the quotation marks).
- In the Properties memo field window, edit the CursorSource property so that it has the full path, not a relative path. For instance, "d:\MyDirectory\Data\MyTable.dbf" instead of "..\MyTable.Dbf." The CursorSource property can be entered with or without quotation marks. However, if the path contains spaces, quotation marks are required.
- Double-click the Properties memo field in the browse window.
- A second resolution is to create the form on a different drive than the one on which the tables are stored. Visual FoxPro stores the complete path in the data environment.
MORE INFORMATION
Steps to Reproduce Behavior
- Type the following code into the Command window:
MD C:\DE_TEST
CD C:\DE_TEST
CREATE TABLE DE_TEST (ID C(10))
MD C:\DE_TEST\FORMS
CD C:\DE_TEST\FORMS
MODIFY FORM DE_TEST
- When the form opens, right-click on the form and select Data Environment. In the Add Table or View dialog box, click Other. In the Open dialog box, find and double-click the table C:\DE_TEST\DE_TEST.DBF.
- Save the form and close it.
- Move the form to a directory on a drive other than C:. For example, move the form to d:\de_test. Run the form by typing the following command in the Command window:
DO FORM D:\de_test\de_test
Note that the following error message is displayed:
Error instantiating cursor object. Could not find (table file name).
REFERENCES
For additional information on the data environment, click the article number below
to view the article in the Microsoft Knowledge Base:
Q128996 HOWTO: Assign Database Location Generically in Data Env
Additional query words:
Keywords : kbContainer kbCtrl kbDatabase kbVFp300 kbVFp300b kbVFp500 kbVFp500a kbVFp600 KbDBFDBC kbGrpFox kbDSupport
Version : WINDOWS:3.0,3.0b,5.0,5.0a,6.0
Platform : WINDOWS
Issue type : kbprb