DAO searching all fields in Record

asid

Registered User.
Local time
Tomorrow, 09:49
Joined
Jan 25, 2006
Messages
22
Hi
Can someone help what would be the best way to search multiple fields in a record and update only those whom value is equal to a varible string (stringX). There could be 60 fields in the record and only some of them will need updating. Looping through each record I can only think to do it this way:

Must be a better than than this?

Do Until rstDat.EOF

if rstDat.field1 = stringX then
rstDat.Edit
rstDat.field1 = NewStringX
rstDat.Update
end if

if rstDat.field2 = stringX then
rstDat.Edit
rstDat.field2 = NewStringX
rstDat.Update
end if

etc
etc
etc
rstDat.MoveNext
Loop
 
The easiest way would be to do it manually by opening the table and using the Replace function from the Edit menu.

^
 
needs to be automated

The client will be updating the data regularly so it needs to be automated. :)
 

Users who are viewing this thread

Back
Top Bottom