Pat, did you look at Arnel’s database he posted. I am not seeing what is wrong with it. Can you expound on your method please.
You might want to reread #8 again
Arnel's query definitely doesn't product a 100 plus records though.
There are 4 records in the data table and 1000 records in the counter table. Therefore the query will produce 4 x 1000 = 4000 records. The where clause will then whittle that down to nine records. Remove the where clause to see what the cross join does. You only have 4 records in the test table so you should be able to clearly understand what the cross join is doing. The query engine must create the 4,000 records in memory BEFORE it can apply the where clause. Just because you don't see them doesn't mean they weren't created in order to get to the answer you need.
Then start again with that same query1 but make two changes.
1. remove the where clause
2. draw a join line between the quantity field and the number field. Switch to SQL view and change the "=" to ">="
Here's the modified query:
SELECT tblLineItems.parentID, tblLineItems.item, tblLineItems.quantity, tblCounter.number
FROM tblLineItems INNER JOIN tblCounter ON tblLineItems.quantity >= tblCounter.number
ORDER BY tblLineItems.item, tblCounter.number;
I included the number field from the counter table because I think it should be there to identify each row.
Here's the modified query1
SELECT tblLineItems.parentID, tblLineItems.item, tblLineItems.quantity, tblCounter.number
FROM tblLineItems, tblCounter
WHERE (((tblCounter.number)<[quantity]+1))
ORDER BY tblLineItems.item, tblCounter.number;
That will show you the difference. My query returns the same nine records but didn't have to create 3, 991 useless ones first.
I will repeat again, the example arnel posted will produce the same results as my suggested change. The difference is simply efficiency. But when you have only 4 records in one table and a relatively small list in the other table, NOTHING matters. However, if you want to use this technique on a larger set of records, you will find the cross join to be unusable because of the huge intermediate recordset it has to create.
There are situations where you actually do need to use the cross join. This just isn't one of them.