Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP to ACCESS
Message
From
30/04/2008 09:10:35
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01314154
Message ID:
01314159
Views:
21
This message has been marked as the solution to the initial question of the thread.
Hi Julie.

>I have the code below which opens an access database and a FoxPro table. I want to populate the access table from the fox data. When I execute the INSERT statement foxpro popups a box asking me for the accounts table.

The INSERT command is for VFP tables and cursors only.

Why not use ODBC rather than Automation? It would make the code a little simpler. For example:
lnHandle = sqlstringconnect('Driver=Microsoft Access Driver (*.mdb);' + ;
   'dbq=H:\Source Code\Access Test\db1.mdb')
if lnHandle < 1
* didn't connect, so use AERROR() to find out why
   return
endif
USE table1  &&& Fox Table with same stucture
scan
   cAccid=table1.accid
   cAccountnum=table1.accountnum
   cAccountNam=table1.accountnam
   cPswd=table1.pswd
   lnResult = sqlexec(lnHandle, 'INSERT INTO accounts ' + ;
      '(accid, accountnum, accountnam, pswd)' + ;
      'VALUES (?cAccid, ?cAccountnum, ?cAccountNam, ?cPswd)')
   if lnResult < 1
* failed to update, so use AERROR() to find out why
   endif
endscan
use
sqldisconnect(lnHandle)
Doug
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform