keschuster
asked on
MS Access - Create Multiple Records based on value in a table
Hey all - Looking for ideas on how to accomplish this. I have the table below in Access. For every location I need to create a records in a table equal to the value of source count. The table below is a query result
Location1 get two records created
Location 2 gets five records created
Location Description SourceCount
Location1 60# Washers 2
Location2 LG/SQ Horizon Front Loads 5
Location3 27# / 30# Washers 9
Location4 S-20# Washers 8
Location5 25# Washers 4
Location6 27# / 30# Washers 2
Location7 LG/SQ Horizon Front Loads 12
Location8 horizon 3
Any suggestions?
Thanks
Location1 get two records created
Location 2 gets five records created
Location Description SourceCount
Location1 60# Washers 2
Location2 LG/SQ Horizon Front Loads 5
Location3 27# / 30# Washers 9
Location4 S-20# Washers 8
Location5 25# Washers 4
Location6 27# / 30# Washers 2
Location7 LG/SQ Horizon Front Loads 12
Location8 horizon 3
Any suggestions?
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
ha I figured it out - there isn't a join! great solution
I do it with the non-equi-join I described but you can also do it as a cross-join with a where clause. So either of the following works.
Select .. From tblA Inner Join tblSeqNum On tblA.Count <= tblSeqNum.SeqNum;
OR
Select .. From tblA, tblSeqNum Where tblA.Count <= tblSeqNum.SeqNum;
The advantage of the cross join is that it can be displayed in the QBE whereas the non-equi-join cannot.
Select .. From tblA Inner Join tblSeqNum On tblA.Count <= tblSeqNum.SeqNum;
OR
Select .. From tblA, tblSeqNum Where tblA.Count <= tblSeqNum.SeqNum;
The advantage of the cross join is that it can be displayed in the QBE whereas the non-equi-join cannot.
ASKER