Generate in between numbers (1 Viewer)

Ihussein

Registered User.
Local time
Today, 08:59
Joined
Nov 11, 2015
Messages
47
I have ms-access table (A) as below, and I want a macro/VBA code that allow me to generate the in between serial number as shown in table (B).
Regards
Table (A) --------------------------------
ID Name Size From To
1 Sarah Umer 3 1 3
2 Tallia Noor 2 4 5
-----------------------------------------
Table (B)--------------------------------
ID Name Size
1 Sarah Umer 1
1 Sarah Umer 2
1 Sarah Umer 3
2 Tallia Noor 4
2 Tallia Noor 5
-----------------------------------------
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 05:59
Joined
Jul 9, 2003
Messages
16,245
You need to put table A in a recordset and loop through the values. Extract the values. Use a For Next Loop to generate the numbers between From - To. Place the values into an update SQL statement, run the SQL update statement to add the values into table B.
 
Last edited:

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 05:59
Joined
Jul 9, 2003
Messages
16,245
I have started a thread on my website with further info here:-

Create Many Records

A sample database demonstrating the process is available from the Website for free just use the coupon code:- "BuyMeA_Coffee!"
 
Last edited:

Ihussein

Registered User.
Local time
Today, 08:59
Joined
Nov 11, 2015
Messages
47
I have added another field which it's date column, and I want to generate serial only for the records which are having dates and leave the records which have no dates.
Thanks
 

Users who are viewing this thread

Top Bottom