VBA Code to Update Data

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

I have some data that needs to be updated with information that is stored in
previous records in the table. The table has two different line types, one is
the header or Type "1" and the other is the detail or Type "2" records.

The Header Record is listed first in the row of the table, then the
corresponding detail records, (in this case 1 to 72 separate rows) are
included after the header. Then another header record and more detail records
etc. The header record does have a field which provides how many detail
records are associated with it.

I have created a table which I am appending the Header and the Detail
records in their correct fields. I need to write an update query to bring
over some of the Header information to the Detail Records Rows. Of course I
need the Header information to only update the detail rows that are
associated with it.

I think I need to create an update query and then use possibly a Do Loop
statement to accomplish this task but I am not sure where to start.

Any help will be greatly appreciated.

Thanks,

David
 
David,

I'm afraid you have started out with a bad design, so what you really need
is to correct that. In a good design, you would have headers and details in
two separate tables, joined on a common field (the header record PK field).
Also, in a good design there should be no common data between the two
tables, other than the header table PK field.

I strongly suggest you revisit your design before you go on with your
development. You will have to do it at some point, so the sooner the better.
If you need help with it, the best NG to post is tablesdbdesign.

HTH,
Nikos
 
Back
Top