Adding a Range of numbers from form to a table

  • Thread starter Thread starter tai.cabrera
  • Start date Start date
T

tai.cabrera

What I would like to do is input a range of serial numbers in a form
and have that range populate in the table without me having to put them
in one at a time manually. The numbers do not exist yet, either. I'm
not sure how else to explain it.

The tables I use have the following Fields:
Table 1
(PK) Serial Number
Date Sold
Sold By

Table 2
(PK) Serial number
Date Redeemed
Redeemed By

This is for a gift certificate database. Sometimes we sell more than
one gift certificate at a time by the same seller on the same date.
Sometimes we sell up to 1000 to 1500 gift certificates a day so you can
see that inputting the certificate number can get tedious at times. I
have 2 different forms aswell

Here are the following fields for both forms:

Form 1:
From Number
To Number
Date Sold
Sold By

Form 2:
From Number
To Number
Date Redeemed
Redeemed By

I also want to be able to detect if a serial number in the redeemed
database, doesn't exist in the sold database. As well as catch
duplicate serial numbers sold and redeemed. Does this make any sense
and is it doable. Thanks for your help
~tai
 
Yes its doable, create a form with two textboxes and a command button.
Call textbox 1 TB1 and textbox 2 TB2.
I'm assuming the first contains the starting serial # and the second the
ending serial #
In the onClick event for the command button put something like this
(untested code):
Dim strSQL as string, i as integer, j as integer
i = CInt(Me.TB1)
j = CInt(Me.TB2)
While i <= j
strSQL = "INSERT INTO tblSerialNumbers (SerNum) Values (" & i & ")"
CurrentProject.Connection.Execute strSQL
i = i +1
Wend

-Dorian
 
Back
Top