PRB: Space in CREATE FROM Field Name Causes Error (259000)



The information in this article applies to:

  • Microsoft Visual FoxPro for Windows 3.0
  • Microsoft Visual FoxPro for Windows 3.0b
  • Microsoft Visual FoxPro for Windows 5.0
  • Microsoft Visual FoxPro for Windows 5.0a
  • Microsoft Visual FoxPro for Windows 6.0

This article was previously published under Q259000

SYMPTOMS

If you accidentally add a space to a field name in a table created with the COPY STRUCTURE EXTENDED command, after creating the table with the CREATE FROM command, any immediate attempt to access that field (such as with a BROWSE statement) fails with the following error:
The data source for this object must be a variable reference.
If the table is in a database, any later attempt will fail with the same error. If it's a free table, closing the table and re-opening it causes Visual FoxPro to replace the space in the field name with an underscore.

MORE INFORMATION

Steps to Reproduce Behavior

Run the following code in the Command window:
* Start of Code
USE HOME() + "labels"

COPY STRUCTURE EXTENDED TO tableFrom
USE tableFrom EXCLUSIVE
ZAP
INSERT INTO tableFrom ;
    (field_name, field_type, field_len) ;
    VALUES ;
    ("a a", "C", 10)

CREATE DATABASE dbcTo

*!* VFP 3 creates the table in the open database.
*!* CREATE tableTo FROM tableFrom 
*!* VFP 5 and 6 allow you to specify the database 
*!* when creating a table.
CREATE tableTo DATABASE dbcTo FROM tableFrom 

*!* Note: if you run the VFP 3 code in VFP 5/6 and
*!* then use the ADD TABLE command, the error you 
*!* will get on BROWSE is :
*!* "The fields in table 'c:\temp\tableTo.dbf' 
*!* did not match the entries in the database."
SELECT tableTo
BROWSE
*End Of Code

REFERENCES

For more information about the CREATE FROM and COPY STRUCTURE EXTENDED commands, please see the Help files.

Modification Type:MajorLast Reviewed:5/10/2003
Keywords:kbCodeSnippet kbDatabase kbnofix kbprb kbXBase KB259000 kbAudDeveloper