> I am trying to write some VBA code to overwrite duplicates in an
existing table with records that are imported. However I don't want to
overwrite the fields in the exisiting records if the imported file
contains blanks in its fields. Does anyone have any suggestions?
Are you executing sql in your code or are you opening recordsets and stepping
through the records (or using multiple recordsets and findfirst) to update the
values? If using recordsets, I might use this approach:
'**
'Assuming rs2 is already in .Edit mode
If Len(Trim(rs1!Fi eld1) & "") > 0 Then 'If not null or zero-length strings
rs2!Field1 = rs1!Field1
End If
'**
If executing sql, I don't know that an Update query can be written to do that.
--
Bruce M. Thompson, Microsoft Access MVP
bt******@mvps.o rg (See the Access FAQ at
http://www.mvps.org/access)
NO Email Please. Keep all communications
within the newsgroups so that all might benefit.<<