Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Pass Through to Acess Tables with spaces in name
Message
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00438571
Message ID:
00438749
Views:
11
Andrew,

I really appreciate the feedback. Sometimes when one is frustrated one's brain just does not function 100%. I had seen how VFP handled a Remote View to an Access table with spaces in the name but I just never paid any attention to the fact that VFP was using double quotes and I was using the brackets. In my mind single quotes, double quotes, and the square brackets were all interchangable. Since my using the bracket version of VFP's example did not work I started trying every possible combination but they ALL failed. Now I see that it works if I use the double quotes instead of the brackets as in "ACCESS TABLE".FIELD1 instead of [ACCESS TABLE].FIELD1.

Thanks again. Today is starting to be a much better day than yesterday :-)>>>>

Ed

>Hi Ed,
>
>Without trying it here, I'd suggest that you swap the delimiter you use so you get
lcUpNameLst = [field1 "ACCESS TABLE".FIELD1,field2 "ACCESS TABLE".FIELD2]
or even
lcUpNameLst = [field1 "ACCESS TABLE"."FIELD1",field2 "ACCESS TABLE"."FIELD2"]
My (vague) recollection is that the double quotes tells the database (in this case access) that everything between the quotes is to be treated as a component of the database.owner.table.field hierarchy.
>
>Cheers,
>
>Andrew
>
>
>>I am having a problem with updating an Access table from a VFP table when the Access table has a space in the name. My code works fine if there is no space in the table name but bombs if there is a space no matter what I do.
>>
>>I don't show it here but my code has no problems when there are spaces in the field names. It is spaces in the table names that is giving me problems.
>>
>>The over-simplified and edited code looks something like this.
>>
>>***START
>>
>>gnConnHand=SQLSTRINGCONNECT(lcConnString)
>>=SQLSETPROP(gnConnHand, "Asynchronous", .T. ) && Needed for long table names.
>>lnPrepare = SQLPrepare(gnConnHand, lcSQLString, 'cRemoteView')
>>lnExec = SQLExec(gnConnHand)
>>SELECT cRemoteView
>>
>>*|
>>*| Make the Access cursor Updatable.
>>*|
>>*| The Access table that we want to update.
>>=CURSORSETPROP("Tables", lcTable)
>>*| List of Acces fields with table alias
>>=CURSORSETPROP("UpdateNameList",lcUpNameLst)
>>*| The key field used to match both the Access and dbf tables.
>>=CURSORSETPROP("KeyFieldList",lcKeyField)
>>*|List of Access fields to update w/o alias'
>>=CURSORSETPROP("UpdatableFieldList",lcAccessFields)
>>*| Do the updates.
>>=CURSORSETPROP("SendUpdates",.T.)
>>
>>SELECT VFP_Table
>>SCAN
>> SCATTER MEMO TO aTransfer
>> SELECT cRemoteView
>> GATHER MEMO FROM aTransfer
>> *| The original Access record will be updated as soon as you move off of the cursor record.
>> SKIP 1
>> SELECT VFP_Table
>>ENDSCAN
>>
>>***END
>>
>>Basically the memvars look something like this:
>>
>>lcTable = "Access Table"
>>lcUpNameLst = "field1 ACCESS TABLE.FIELD1,field2 ACCESS TABLE.FIELD2"
>>lcKeyField = "ID"
>>lcAccessFields = "FIELD1,FIELD2"
>>
>>With the lcUpNameLst memvar in the above configuration I get an error on the line
>>=CURSORSETPROP("UpdateNameList",lcUpNameLst)
>>which says "Invalid Update Column Name "Table".
>>Obviously the space is making the command see the next word after the space as a column name and not part of the table name.
>>
>>If I change lcUpNameLst to the form:
>>lcUpNameLst = "field1 [ACCESS TABLE.FIELD1],field2 [ACCESS TABLE.FIELD2]"
>>
>>using the brackets as quotes to isolate the table name, I get an error on the command SKIP 1 that says
>>"No Update tables are specified. Use the Tables property of the cursor."
>>
>>I have tried [Access Table].field1
>>I have tried lcTable = "[Access Table]"
>>
>>but no matter what I try I will get an error on one of the two lines.
>>
>>Can anybody offer a clue as to what I may be doing wrong?
>>
>>TIA
>>
>>Ed
Previous
Reply
Map
View

Click here to load this message in the networking platform