Table Update Question

G

Guest

I recently took over a database that I am in the process of normalizing. I
would like to update a foreign key in one table based on the primary key of
another. The tables and fields are:

tblTraineeInformation tblTraineeList
strName strName
TraID (FK) TraID (PK)

What I would like to do is delete the strName field in tblTraineeInformation
and update the TraID (FK) field with the corresponding TraID (PK) in
tblTraineeList. Can this be done with a query, or is it better to update
through VBA? I have about 20k records to update in tblTraineeInformation
with about 120 records in tblTraineeList.

If I update via VBA, my idea was to pass an array, containing TraID (PK) and
strName (tblTraineeList), to a function, compare strName
(tblTraineeInformation) and strName (tblTraineeList), and update TraID (FK)
if there is a match. Would this be the best way to do it or is there a more
efficient way? Thanks.
 

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