|
-
February 28th, 2000, 11:36 AM
#1
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!
-
February 28th, 2000, 12:47 PM
#2
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
-
February 28th, 2000, 12:50 PM
#3
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|