I'm trying to extract all of the data from an Access MDB into VFP tables
in a database container so that I can process the data in VFP...

The sample code is below...

In SOME cases (about 4 of 51 tables) when I try to open the resulting table I get the message:

     "Database is invalid, Please Validate"

When I validate, it deletes the tables...Not good I need a couple of them.

Output from VALIDATE:

Validate Database ACCESSACCESS:
Rebuilding structural index....  Index rebuilt.
Object #2664 (Table 'people'): Cannot open table 'c:\lifering\people.dbf'.

I tried a "set step" after the sqlexec() and then tried to browse the cursor "ac_table" and got:

  "The data source for this object must be a variable reference."

which, as usual, makes no frickin' sense...

What's going ON? How can I get the data I need and be able to use it in VFP?

PS: The same thing happens in VFP 8 and VFP 9...

******

My basic need is to extract the data from about 6 or 7 of the tables, potentially edit, add, delete records and then save the changes back to the Access MDB. Maybe there's a better way???


*-- *************************************
*-- This is a sample of the code I'm executing for
*-- each of 51 tables in an access database (.MDB)
*-- I've enclosed it in a loop, of course...

*-- Create CLEAN new database (yes, it was deleted)
CREATE DATABASE AccessAccess

*-- Connect to Access
lcMDB = GETFILE('mdb')
lnHandle = SQLStringConnect("Driver={Microsoft Access Driver (*.mdb)};Dbq=" + lcMDB)

*-- table to get
lcTableName = "People"

*-- Select all records from the Access Table
WAIT WINDOW "Get records for " + lcTableName NOWAIT
USE IN SELECT("ac_table")
SQLEXEC(lnHandle, "select * from " + lcTableName, "ac_table")
IF USED('ac_table')
   SELECT ac_table
   IF RECCOUNT() > 0
       *-- Write table if got some
       COPY TO &lcTableName. DATABASE AccessAccess
   ENDIF
ENDIF
lnHandle = .NULL.




_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to