Using data in a CSV to update a DB

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
 
P

Pete D.

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

Philip Herlihy

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
 
I

Isis

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
 

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