Update entire record using VBA

Timtropolis

Registered User.
Local time
Today, 04:31
Joined
Jun 17, 2004
Messages
84
Greetings,

I have two recordsets. One is based off a table that represents existing data, the other a table is based off an update file. I have DAO code that goes thru each record set and matches the recs on unique id. Once that is done I want to to compare the dates per record , per table.

ie -

table1, rec1, date = a date in time
table2, rec1, date = a date in time

If table1 does not match table2, then I want to update table1 rec with table2 rec.

Now my question.. Is there a way to update the entire record at once?

This is what I thought I could do:

With rst
.Edit
rst = rst2
.Update
End With

This however is not working. I've been looking on the board here and have not found anything so I was wondering if someone knew of a way to this without having to list every field and update. (There are 53 fields in this table).

Any help would be appreciated.
Tim
 
You need to refrence the field to update

with rst
.edit
.fields("NameOfField")=rst2.fields("NameOfField')
...
...
...
.update
end with

I don't see why you wouldn't use an update query to update the records.
 

Users who are viewing this thread

Back
Top Bottom