Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Copy to Access MDB
Message
From
03/03/2004 16:44:27
Dave Nantais
Light speed database solutions
Ontario, Canada
 
 
To
03/03/2004 16:29:03
Joel Hokanson
Services Integration Group
Bellaire, Texas, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00882905
Message ID:
00882912
Views:
17
>Is there a reasonable way to copy data from a VFP table to an Access MDB?

I use SQL Passthrough...

first you connect to the Access database this way

lcConnect = "DBQ=" + m.AccessDB + ";" + ;
"DEFAULTDIR=" + m.AccessDir + ";" + ;
"Driver={Microsoft Access Driver (*.mdb)};DriverId=281;" + ;
"FIL=MS Access;MaxBufferSize=2048;PageTimeout=5;"

m.lnConnect = SQLSTRINGCONNECT(lcConnect)

Where m.AccessDB is the full path of the Access database.
m.AccessDir is the directory of the Access database.

m.lnConnect hold the connection handle for the access database..

When m.lnConnect > 0 you have a valid connection to the Access database.

then issue a series of commands to add records to the relavent tables
via
m.result=SQLEXEC(lnConnect,lcQuery)

Where m.lcQuery is the Access MDB command for adding a new record.

The cool thing is that once you've established a connection to the Access MDB you are passing Access SQL commands DIRECTLY via the SQLEXEC command.

Thus, you are using Access/JET SQL language to add records.

then issue

= SQLDISCONNECT(lnConnect) to release the connection with the AccessMDB

good luck
Previous
Reply
Map
View

Click here to load this message in the networking platform