Click to See Complete Forum and Search --> : Dual database interaction
Janitor
Aug 26th, 1999, 03:46 PM
I am working on a program that reads information from a number of FoxPro tables via ODBC and places results into a Access database. I am able to pull the needed records from the FoxPro tables into either a recordset or query object, but I am not sure the best way to then insert these records into the second database. Any code ideas? Thanks.
Jay D Zimmerman
JHausmann
Aug 26th, 1999, 06:53 PM
Use ODBC for the FoxPro database and DAO for the Access (if you can swing it, use DAO for both). Simply put, you're gonna have two database objects in your code...
If you're using DAO for Access create a data control, then, you should then do something like:
qry= "select * from odbc_table"
set recordset= odbcDB.OpenRecordset (qry, dbOpenSnapshot)
if recordset.EOF = false then
Do While Not recordset.EOF
With form.datacontrol.recordset
.AddNew
!Field0 = Recordset.Fields(0)
!Field1 = Recordset.Fields(1)
' [...]
'FieldX = Recordset.Fields(x)
.Update
.Bookmark = .LastModified
End With
recordset.MoveNext
loop
end if
recordset.close
[This message has been edited by JHausmann (edited 08-27-1999).]
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.