Need To Loop Thru Records And Update

P

pcm1977

I have two tables “RGA” and “RGACOMM”. RGACOMM is a linked table that
is updated daily.

RGACOMM has the following fields:
RGANumber - Text
PartNumber - Text
RecDate - Short Date
RecQty - Text

The RGA table has the same fields plus more.

I wish to update the “RecDate” and the “RecQty” in the RGA table with
the data in the RGACOMM table based the criteria in the "RGANumber”
and “PartNumber” fields. Then automatically move to the next record
in the RGACOMM table and start the entire process over again searching
the RGA table for the matching criteria.

I would prefer to have this all done automatically with no user input.

Thank You
 
J

Jeff Boyce

The concept of "looping" through might apply in other circumstances, but
Access is a relational database, and offers "set-level" operations.

If you are adding (appending) new records from data in [RGACOMM], look into
using an "append query".

If you are updating existing records in [RGA] based on corresponding records
in [RGACOMM], look into using an "update query".

Search on either/both terms in Access HELP for more specifics.

Regards

Jeff Boyce
Microsoft Office/Access MVP

I have two tables “RGA” and “RGACOMM”. RGACOMM is a linked table that
is updated daily.

RGACOMM has the following fields:
RGANumber - Text
PartNumber - Text
RecDate - Short Date
RecQty - Text

The RGA table has the same fields plus more.

I wish to update the “RecDate” and the “RecQty” in the RGA table with
the data in the RGACOMM table based the criteria in the "RGANumber”
and “PartNumber” fields. Then automatically move to the next record
in the RGACOMM table and start the entire process over again searching
the RGA table for the matching criteria.

I would prefer to have this all done automatically with no user input.

Thank You
 
L

Lance

Storing identical data in 2 tables isn't usually the way you want to go.
Instead of going through any update process you should first look to see if
there's a reason you can't do what you need to do with a query joining the 2
tables.

If you really do need to do this update process, you don't seem to need any
kind of complicated looping process. You can just run a simple update query
to accomplish that.
 

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