removing empty records, leading spaces

K

Ken N

I have inherited a database that was imported from an
excell spreadsheat. Many of the records are empty. MOst
of the first name fields have leading spaces. Often, when
I (manually) remove leading spaces, I get duplicate name
index problems. Is there an easy way (VBA?) to clean up
this file?
 
A

Allen Browne

Ken, the easiest way to import data is usually to import into a temp table
that has no validation rules. Then run a series of queries to clean up and
validate the data.

Example to clean up the FirstName field:
db.Execute "UPDATE MyTemp SET [FirstName] = Str2Null([FirstName]);"
where Str2Null() is a function that trims the spaces and converts
zero-length strings to Null.

You would also run some outer join queries to find unmatched foreign keys
(like Unmatched query wizard), group-by queries to find duplicates, etc.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top