Defining how many times to loop. (1 Viewer)

TobyMace

Registered User.
Local time
Today, 06:15
Joined
Apr 13, 2018
Messages
65
I'm not at all familiar with looping in VBA so I may need to waffle...

I am looking to create a form that, when opened, asks for a "Date", "Quantity" and "Serial number(s)" all in separate input boxes preferably.
How do I accomplish this so that the number of input boxes that appear for "Serial numbers(s)" = the value in "Quantity". The value in "Quantity" can vary each time. "IDD_Number" will be the same for all of those "Serial Number(s)". The "Serial Number(s)" will not be sequential.

I have a list of "IDD" Numbers starting at 18000.
So the first entry is made of 4 serial numbers and all of those have 18000.
Then the next entry of 8 serial numbers to have the IDD number 18001.
And so on.

Once that has been accomplished I want the "IDD_Number" and "Date" to be entered in the corresponding fields against those "Serial Number(s)" in Table "IDD_T". The table will already have the "Serial Number(s)

Make any sense?
Thanks in advance for any help!
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 06:15
Joined
Jul 9, 2003
Messages
16,271
I think having a variable number of text boxes might be a difficult approach. And, what do you do with the information once you put it in the text boxes! How do you get hold of it to use it?

So I don't think it's an approach I would consider, although it would be an interesting and challenging approach for sure!

A better approach would be to add records to a table. If you have a look at my Blog here:-

Create Many Records

I demonstrate a method of creating many records which might just fit the bill...

Most of my sample code is free at the moment you just need to subscribe to my newsletter.
 

Cronk

Registered User.
Local time
Today, 15:15
Joined
Jul 4, 2013
Messages
2,771
Or use a form with a sub form for the serual numbers.
 

TobyMace

Registered User.
Local time
Today, 06:15
Joined
Apr 13, 2018
Messages
65
Hi Uncle Gizmo!

I have come across your "Create Many Records" before actually and really helped me with one of my projects so thank you very much for that!
The only issue I have for this case is that the "Serial Number(s)" won't necessarily be sequential. The Serial Numbers will be entered by barcode scanning.
A way that would make sense for staff here and keeping it easy for them, in my eyes, would be to ask for "IDD Number", "Date", Number they are "IDD'ing" or "Quantity" , and then ask for the "Serial Number(s)" they are scanning in and it'll ask for the same number as defined in "Quantity".
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 06:15
Joined
Jul 9, 2003
Messages
16,271
Picking the bones out of what you've said I have identified that you have this pre-existing information..

"IDD Number", "Date", "Quantity", "Serial Number(s)" (you must scan in this many:- "Quantity")

You could have a form with text boxes for:- "IDD Number", "Date", "Quantity" and "Serial Number"

You would scan the serial number into the serial number text box and this generates a record which appears in a subform below the text boxes.

Each scan would also trigger the after update event of the serial number text box, which would clear out the "serial number" text box ready for the next scan.

When the number of scans reached "quantity" you would get a warning...

Does that sound something like what you need?
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 06:15
Joined
Jul 9, 2003
Messages
16,271
One of the user cases which was derived from the Checklist Series of Videos I did was to have the ability to scan barcodes into pre created records.

I think that would also work, the only fly in the ointment is you would have to create a specific "different" number of Records each time. What I'm worried about is I think there's more to go wrong..

The example I'm thinking of is here:- Document Batches of Case Files (MS Access)
 

TobyMace

Registered User.
Local time
Today, 06:15
Joined
Apr 13, 2018
Messages
65
That was a method I considered but I would prefer the "IDD Number" to almost be an auto number field but for each set of serial numbers. So 18000 for the first set of 10, 18001 for the next set of 4 for example. I'd rather not have my user's looking up the last IDD number and entering it manually as this is very susceptible to human error.
The "Serial Number(s)" are the only fields to be entered by barcode.
Also the serial numbers do already exist in a table so was hoping I could do some sort of lookup function to find the Serial Numbers entered, "123456" and "123459" for example and enter the IDD Number and date next to it.
I am finishing up for the weekend shortly so will look through your methods next week and see if I can use them in some way.
Thanks for all your help and sticking with me! I'll get back to you to let you know how it's going.
 

TobyMace

Registered User.
Local time
Today, 06:15
Joined
Apr 13, 2018
Messages
65
I managed to find away around this using an excel spreadsheet (we have to fill this anyway) and by typing the IDD_Number number is able to find the file and gather all the information needed. Thanks for sticking with me!
Anyone reading this looking for answers I would highly recommend checking out the links supplied by Uncle Gizmo above. Some brilliant stuff there!
 

Users who are viewing this thread

Top Bottom