How to generate a range of numbers between two numbers?

Leo2019

New member
Local time
Tomorrow, 00:33
Joined
Jul 27, 2019
Messages
8
Hello Everyone!

In our company, we handover a number of booklets to our delegates and we need to track the serial numbers with each one.
So, I've created a form to record the starting & ending range of the booklets, I need VBA to list a preview to the booklets within the written range when I hit the button ( Preview) which will record 3 fields ( Delegate, Date, & Booklet number ) for each of the booklets.

Then, after reviewing the numbers & make sure they are accurate, I shall hit the other button "Register" to add them to the table.

A quick introduction to the database:
1- (Table) Delegates: Stores the names of the delegates.
2- (Table) Temp_Delegates_Booklets: Stores the preview data, erase all data each time ahead of the preview.
3- (Table) Delegates_Booklets: Stores the final data after revision.
4- (Form) Register_Booklet: The interface for the entry process.
5- (Form) Temp_Delegates_Booklets subform: Preview the data of the booklets before storing them in #3 (Table) Delegates_Booklets

Thanks in advance :)
 

Attachments

Hi. Are you trying to create multiple records with sequential numbers for the booklet numbers? If so, you might look into using a Tally table. Are you planning to enter any data in the "preview" subform?
 
Hi. Are you trying to create multiple records with sequential numbers for the booklet numbers? If so, you might look into using a Tally table. Are you planning to enter any data in the "preview" subform?
Hi DBguy!
Appreciate your fast response.

Yes. It's sequential numbers.
I don't know what a Tally table is.
No, I'm using the preview for checking only, if there is another way without the need to use it, this would be great.
 
Hi DBguy!
Appreciate your fast response.

Yes. It's sequential numbers.
I don't know what a Tally table is.
No, I'm using the preview for checking only, if there is another way without the need to use it, this would be great.
Hi. Check out this article to see what I mean by a Tally table.
 
Weird, this is almost exactly like this thread:


I'll reconfigure my post from there:

This is pretty simple, even if you don't know VBA I suggest you give it a shot. I'll help by writing the psuedo code:

Code:
Sub AddBooklets()

for i=0 to Me.BookletsTo
DoCmd.RunSQL("INSERT INTO YourTable (BookletsNumberField) VALUES (" & i + Me.BookletsFrom " &")")
Next i
End Sub

Again, that's pseudo code which means it illustrates the ideas you need in your code but not the exact syntax.
 
Thank you @theDBguy I've checked the article, I'll give it a try & feedback.
I have also posted a demo using a Tally table in this other thread.
 
Thank you @arnelgp
I guess the booklets in your sample db requires to be registered in the table, right?
 
Yes you have to put all the booklet in the table first.
 

Users who are viewing this thread

Back
Top Bottom