Creating multiple records from a specified range (1 Viewer)

TobyMace

Registered User.
Local time
Today, 07:47
Joined
Apr 13, 2018
Messages
65
Hi all,

I am trying to make it possible to create a certain number of records where one of the fields is equal to all values in between a specified range.
So I have fields A, B and C.
I want to specify the range for A (Something in the format of 7290/0001 to 7290/0200). The first four number may change so I can't make it an autonumber field.
Specify what I want B and C to be for all those records within that range only (I may want to specify something else for A and B for a later range).
Is this possible?
Thanks in advance.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 01:47
Joined
Feb 28, 2001
Messages
27,131
It is possible programmatically or you can create records based on something called a Cartesian JOIN, which you need to look up very thoroughly before you do it. Because it is the best way I know to fill up a database with useless stuff.

However, if you are trying to pre-generate empty records, you might wish to consider that Access is perfectly capable of generating complex IDs on the fly. Not saying that you can't do this or should never do this, but it is one of those "warning flag" items that makes me ask, "Why?"
 

TobyMace

Registered User.
Local time
Today, 07:47
Joined
Apr 13, 2018
Messages
65
Hi Doc Man,


Thanks for your reply! I was contemplating a linked excel spreadsheet. I will give Cartesian JOIN a look.
Thanks for your warnings! :)
 

RogerCooper

Registered User.
Local time
Yesterday, 23:47
Joined
Jul 30, 2014
Messages
283
Hi all,

I am trying to make it possible to create a certain number of records where one of the fields is equal to all values in between a specified range.
So I have fields A, B and C.
I want to specify the range for A (Something in the format of 7290/0001 to 7290/0200). The first four number may change so I can't make it an autonumber field.
Specify what I want B and C to be for all those records within that range only (I may want to specify something else for A and B for a later range).
Is this possible?
Thanks in advance.
You may find it useful to have a table of numbers in sequence. I keep a table of numbers from 1 to 100000, with the text equivalent, which I can use to generate records in a controlled fashion.
 

TobyMace

Registered User.
Local time
Today, 07:47
Joined
Apr 13, 2018
Messages
65
Hi All,

Thanks for your replies! Apologies for the delayed response but I have discovered a way around this using a linked excel spreadsheet. :)

Kind regards,

Toby
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 07:47
Joined
Jul 9, 2003
Messages
16,271
I recently answered a post in a similar vein. You may, or someone else who happens upon this thread may find it useful...

There is a video on my website here:-

Create Many Records

Which provides a demonstration of a for next loop within a recordset loop. The Recordset Loop provides the start and end values for the For Next Loop. The for next loop calls a function which insert the data into a table. The whole system is designed to quickly and easily create sets of Records dependent on some criteria stored in a table. The code was initially created in answer to a specific question on Access World Forums. I realised that it was an excellent example of using a Recordset Loop and a For Next loop together.
 

Users who are viewing this thread

Top Bottom