Microsoft KB Archive/259000

= PRB: Space in CREATE FROM Field Name Causes Error =

Article ID: 259000

Article Last Modified on 5/10/2003

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0 Standard Edition
 * Microsoft Visual FoxPro 3.0b Standard Edition
 * Microsoft Visual FoxPro 5.0 Standard Edition
 * Microsoft Visual FoxPro 5.0a
 * Microsoft Visual FoxPro 6.0 Professional Edition

-



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.



Steps to Reproduce Behavior
Run the following code in the Command window: * Start of Code USE HOME + &quot;labels&quot;

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

CREATE DATABASE dbcTo

CREATE tableTo DATABASE dbcTo FROM tableFrom
 * !* 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.

SELECT tableTo BROWSE
 * !* 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 :
 * !* &quot;The fields in table 'c:\temp\tableTo.dbf'
 * !* did not match the entries in the database.&quot;
 * End Of Code

