Using data in a CSV to update a DB

  • Thread starter Thread starter Isis
  • Start date Start date
I

Isis

I have a CSV file containing some records - one of the fields is a
membership number that matches a key field in my access DB. I want to loop
through all the records in my CSV and then update the matching records in
the DB based on a condition.

I would like to do this in VBA if possible as I have used it before. How do
I open the CSV and loop through it - read the Membership Number and then
get the matching record to update it's values.

Any help would be very welcome - I am not expecting anyone to provide a
complete solution but if you can get me started that would be great.

Thanks
 
Although VBA is powerful sometimes you should go with the easy. Why not just
import the file and run an update query?
 
Pete said:
Although VBA is powerful sometimes you should go with the easy. Why not just
import the file and run an update query?

Seconded. Will take a tenth the effort, even allowing for the learning
curve!

First, use File, Backup on your existing database.

Import the file as a new table. Create a query selecting the fields of
interest in the existing table, joined with the new table - run it as a
sanity check. Convert the query to an update query, and put the new
value in the "update to" cell. Tip: you can use the Expression Builder
to help you specify the right syntax for the right field from the right
table.

Phil, London
 
Pete & Phil - you seem to be right !

Seems quite straight forward - I am so used to vba'ing all my needs in
Excel I got carried away.

Thanks for the heads up.

Regards
 
Back
Top