lexi0088
Technical User
- Sep 7, 2004
- 49
I have a table in my database (which is a text file import from raw edi data) that I need to somehow group. I would like to first loop through the table and assign a group name to the records. Here is the example of what the table data might look like:
Field1 Field2 Field3 Field4
PTD SS
N1 ST BLOCKED PER CUSTOMER 92
N4 211
QTY 32 1 EA
LIN N4 00525041030
UIT EA 39.74 WH
REF IN 508456
REF QK 1
DTM 003 20080820
QTY 32 1 EA
LIN N4 00525801990
UIT EA 73.35 WH
REF IN 611225
REF QK 1
DTM 003 20080829
QTY 32 1 EA
LIN N4 00525041030
UIT EA 39.74 WH
REF IN 785217
REF QK 1
DTM 003 20080822
PTD SS
N1 ST BLOCKED PER CUSTOMER 92
N4 200
QTY 32 1 EA
LIN N4 00525090690
UIT EA 61.25 WH
REF IN 983383
REF QK 1
REF CT 5330
DTM 003 20080825
This is very difficult for me since every "group" does not have a consistency in how many rows it contains. Each "group" of rows begins where Field1 = "PTD". What I would like to do, is add a Field5 that will identify each group, where every row under the first PTD has a Field5= GRP1. Then every row under the second PTD has a Fild5 = GRP2.
I know there must be some way of doing this in VBA, any help would be appreciated!!
Thank you,
Field1 Field2 Field3 Field4
PTD SS
N1 ST BLOCKED PER CUSTOMER 92
N4 211
QTY 32 1 EA
LIN N4 00525041030
UIT EA 39.74 WH
REF IN 508456
REF QK 1
DTM 003 20080820
QTY 32 1 EA
LIN N4 00525801990
UIT EA 73.35 WH
REF IN 611225
REF QK 1
DTM 003 20080829
QTY 32 1 EA
LIN N4 00525041030
UIT EA 39.74 WH
REF IN 785217
REF QK 1
DTM 003 20080822
PTD SS
N1 ST BLOCKED PER CUSTOMER 92
N4 200
QTY 32 1 EA
LIN N4 00525090690
UIT EA 61.25 WH
REF IN 983383
REF QK 1
REF CT 5330
DTM 003 20080825
This is very difficult for me since every "group" does not have a consistency in how many rows it contains. Each "group" of rows begins where Field1 = "PTD". What I would like to do, is add a Field5 that will identify each group, where every row under the first PTD has a Field5= GRP1. Then every row under the second PTD has a Fild5 = GRP2.
I know there must be some way of doing this in VBA, any help would be appreciated!!
Thank you,