Hi,
I created a tape library in Access 2003 where people will keep track of backup tapes. It would have been very easy for me to create serial numbers as the user enters each tape, but the requirements are that a serial number is printed first and put on tapes and then the information is entered in the database once the tapes are ready for storage.
The idea is that the user enters the number of labels it needs, and then the serial numbers are created and printed. I don’t know how to create serial numbers without having records already in place, but I have an idea. I created a form with a text box (txtLabels) where the user specifies the number of labels it needs. Then I created a table tblTapeSN with two fields, SequenceNo and chrDate. I’m thinking that I will need this table to keep track of the serial numbers, so every time a user enters a new request for labels I would be find what was the last serial number used and continue from there (I can probably use the Dmax function for that). Then I think I will need to create a loop with an inserts statement that inserts new records in a field, which in turns will create the serial numbers in the TableSN (the SequenceNo field in the tblTapeSN is set to 6 digit auto serial number). I was thinking about using the Date() function as the data to be inserted and store it in the chrDate field.
The problem I have is how to create the loop with the SQL statement and reference the txt box as number of records to be input. For the insert I think I may be able to use something like:
Sub Main()
Dim a, b as integer
a =0
e = number from the txtLabel
While a <= e
a - =1
e + =1
End while
Insert into tblTapeSN (chrDate)
Values (data() )
End Sub
There is also the issue of finding the last serial number used, and continue the serial numbers from there, and then printing the output of that specific group of s/n.
Any help will be greatly appreciated.
I created a tape library in Access 2003 where people will keep track of backup tapes. It would have been very easy for me to create serial numbers as the user enters each tape, but the requirements are that a serial number is printed first and put on tapes and then the information is entered in the database once the tapes are ready for storage.
The idea is that the user enters the number of labels it needs, and then the serial numbers are created and printed. I don’t know how to create serial numbers without having records already in place, but I have an idea. I created a form with a text box (txtLabels) where the user specifies the number of labels it needs. Then I created a table tblTapeSN with two fields, SequenceNo and chrDate. I’m thinking that I will need this table to keep track of the serial numbers, so every time a user enters a new request for labels I would be find what was the last serial number used and continue from there (I can probably use the Dmax function for that). Then I think I will need to create a loop with an inserts statement that inserts new records in a field, which in turns will create the serial numbers in the TableSN (the SequenceNo field in the tblTapeSN is set to 6 digit auto serial number). I was thinking about using the Date() function as the data to be inserted and store it in the chrDate field.
The problem I have is how to create the loop with the SQL statement and reference the txt box as number of records to be input. For the insert I think I may be able to use something like:
Sub Main()
Dim a, b as integer
a =0
e = number from the txtLabel
While a <= e
a - =1
e + =1
End while
Insert into tblTapeSN (chrDate)
Values (data() )
End Sub
There is also the issue of finding the last serial number used, and continue the serial numbers from there, and then printing the output of that specific group of s/n.
Any help will be greatly appreciated.