Update Access97 Table with Fields From Another Database
Can someone point me in the right direction? I have an Access97 database table that I need to update only certain fields in certain records from another Access database. Adding/Deleting records between the two is not a player. Only updating certain fields. I do not have VB but am hoping I can do this with VBA. If someone can kickstart me, I'll be off and running. Thanks!
Re: Update Access97 Table with Fields From Another Database
Create 2 recordset (DAO or ADO), use data from one of them to update the second one using appropriate criterias.
Vlad
Re: Update Access97 Table with Fields From Another Database
I'm not 100% sure, might just have some little mistakes (don't have acces around), but i've done this before, should look about something like this:
' this example will get the name of user with id 15 out table1 and modify another record in table2
dim db as database
' rst1 is the input table
' rst2 the output table
dim rst1 as recordset
dim rst2 as recordset
dim strName as string
set db = currentdb
set rst1 = db.openrecordset("table1")
set rst2 = db.openrecordset("table2")
rst1.movenext
with rst1
do while not( rst1.eof )
if .fields!uID = 15 then
strName = .fields!Name
end if
loop
end with
rst2.movefirst
with rst2
do while not( rst2.eof )
if .fields!uID = 15 then
.fields!Name = strName
end if
loop
end with
' close recordsets and database refferences
rst1.close
rst2.close
db = nothing
Tom Cannaerts
[email protected]
The best way to escape a problem, is to solve it.