How do I create variable records in Access?

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

Guest

I have a list that has a variable field with numbers. I want to use this
field and create records in a table equal to this number. ie... if the number
is 10, I want Access to create 10 records, containing the same information.
Is there a way to do this?
 
Hi,

You can join to a dummy table with the integers from 1 to the largest number
you require. If you edit the SQL and change the join to >= or <= you will get
the desired effect.

For example;

I've got a table 'tblData' with 2 fields 'Count' & 'Data' - containing 1
record '3', 'Stuff'.

I've got a table 'tblCounter' with 1 field 'Counter' containing 4 records 1,
2, 3, 4.

If I run the query;

SELECT tblData.Count, tblData.Data
FROM tblData INNER JOIN tblCounter ON tblData.Count >= tblCounter.Counter;

I get the effect you are looking for.

Regards,

Chris.
 
Back
Top