code a range of records?

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

Guest

I have a table that contains "header and footer" type records... that is...
the first record in the table is a record that displays "BEGIN BATCH" and
various info about all following records up to the "END BATCH" record. In
other words, there are "batches" of records denoted by beginning and ending
records at each end of the record range. I need to take the value of a field
in the "BEGIN" record and assign that value to all records between the
"BEGIN" record and the "END" record. There are multiple "batches" in the
table that each need to have this value assigned from their respective
"BEGIN" record. I do not control the format of this table as it is created
by a third party program. I've tried using DLookUp but it doesn't "loop"
like I want it to... it basically shifts all values in that field down one
record, rather than assigning to all records in the record range. If anyone
can help, I would appreciate it. Here is a basic example of the table:

BEGIN BATCH X7645 34006 DK430 32
4098903-099 390H4 093KJS 4390U L490U4 40934
4045903-023 3DGH4 4H3K2S 4690U LE5FU4 S9SE
END BATCH O43OI 3490U 4LHJ90 LK

I would need the "32" from the "BEGIN" record assigned to a field in the two
records betweeen the "BEGIN" and "END" record.
 
From the data sample, there doesn't appear to be any similar code that
denotes which BEGIN goes with which END. This could make things rather
difficult.

Regardless, I would solve using VBA code to locate each BEGIN, and walk
through or query the update, until each END
 
Back
Top