> I am trying to write some VBA code to overwrite duplicates in an[color=blue]
> 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?[/color]
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!Field1) & "") > 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
bthmpson@mvps.org (See the Access FAQ at
http://www.mvps.org/access)[color=blue][color=green]
>> NO Email Please. Keep all communications[/color][/color]
within the newsgroups so that all might benefit.<<