KernelK
Registered User.
- Local time
- Today, 12:58
- Joined
- Oct 3, 2006
- Messages
- 173
What I am attempting to do is to update records on a remote
database with records from a local database. The two tables are
identical in design, with the same primary keys and the same
information. I want to update the remote database with changes from the
local database and append any new records from the local database to the remote database as well.
I set up two boolean fields in my tables, one called Uploaded that I mark True if this record has been uploaded and it gets marked False by the local DB if the record is modified, and one called NewRecord so I can tell if this record will
need to be appended instead of modified. So, I can run SQL Select querys
against my local DB to tell which records will need to be sent to the
remote DB for modification and/or appending. With me so far?
Now my problem is, I cannot figure out how to send the information there. I
use ADO for most of my VBA data handling. I attempted to create a
recordset by running a SELECT statement against my local table to pull
all records that have Uploaded = False and NewRecord = False (ie the
record has been modified). After retrieving my "modified" records from the local table, I then set the activeconnection property of
the recordset to the remote table location. I then called the updatebatch method to update the records.
The code runs perfectly without returning an error but does not update the records in the remote table. I suspect it is because I never modified any of the records once they were in my recordset and as such are not flagged to update.
Any ideas on making this method work? Or possibly a better way to do this? I was thinking of doing a docmd.runsql statement, but cannot figure out how to use a local table and a remote table at the same time for that to work. And
then after I get the update to work, I should hopefully be able to tweak
that method some to append all the NewRecord = True antries.
Thanks in advance.
database with records from a local database. The two tables are
identical in design, with the same primary keys and the same
information. I want to update the remote database with changes from the
local database and append any new records from the local database to the remote database as well.
I set up two boolean fields in my tables, one called Uploaded that I mark True if this record has been uploaded and it gets marked False by the local DB if the record is modified, and one called NewRecord so I can tell if this record will
need to be appended instead of modified. So, I can run SQL Select querys
against my local DB to tell which records will need to be sent to the
remote DB for modification and/or appending. With me so far?
Now my problem is, I cannot figure out how to send the information there. I
use ADO for most of my VBA data handling. I attempted to create a
recordset by running a SELECT statement against my local table to pull
all records that have Uploaded = False and NewRecord = False (ie the
record has been modified). After retrieving my "modified" records from the local table, I then set the activeconnection property of
the recordset to the remote table location. I then called the updatebatch method to update the records.
The code runs perfectly without returning an error but does not update the records in the remote table. I suspect it is because I never modified any of the records once they were in my recordset and as such are not flagged to update.
Any ideas on making this method work? Or possibly a better way to do this? I was thinking of doing a docmd.runsql statement, but cannot figure out how to use a local table and a remote table at the same time for that to work. And
then after I get the update to work, I should hopefully be able to tweak
that method some to append all the NewRecord = True antries.
Thanks in advance.