Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

duplicating a field dependant on another field

Status
Not open for further replies.

tdktown

IS-IT--Management
Apr 16, 2001
3
US
Being relatively new with access databases but pretty good with computers in general i need a little help with a solution.

I have a table that contains fields...
order #
line #
quantity
text field1
text field2
text field3

there is no unique id
order # is repeated as many times as there are line numbers.
quantity can be from 1-20 typically

we do a daily import from a text file to update and add new records.

what I am trying to accomplish and not sure the best route is:
i need to repeat each record the number of times=to the total quantity
ie:
if:
order 123 line 1 quantity 3
line 2 quantity 2
line 3 quantity 4


i need
order 123 line 1 quantity 1-3
order 123 line 1 quantity 2-3
order 123 line 1 quantity 3-3
order 123 line 2 quantity 1-2
order 123 line 2 quantity 2-2
order 123 line 3 quantity 1-4
order 123 line 3 quantity 2-4
order 123 line 3 quantity 3-4
order 123 line 3 quantity 4-4

with the corresponding text fields that follow.

basically it is copying a record the number of time equal to the quantity column but substituting the number in the quantity column for 1-3, 2-3, 3-3... with the "-3" representing the total quantity.

any help would be greatly appreciated.

also if I could do it on only the new order maybe as part of the import process (.txt) file that would be ok. I do not need it for existing orders although if the solution required would be able to implement that as well.

thanks in advance...

TD
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top