Insert multiple records with a number range in MS Access
How would one add multiple records in a DB Table for numerical values. I have a table called Issue (Customer, Issue Date, Sealno.) where a user fills in the sealno. of the first seal and sealno. of the last seal. The first seal and the last is the range. In the table record of the first seal to the last will be filled all with the same Customer name and Issue Date.
My DB name is Seals;Table name Issue. The below macro is initiated by a save button in the DB Form;
Private Sub Command17_Click() Dim rsIssue As DAO.Recordset Dim Seal As Date Set rsIssue = CurrentDb.OpenRecordset("Select Top 1 * From Issue") Seal = Me!Seal1.Value While DateDiff("d", Seal, Me!Seal2.Value) >= 0 rsIssue.AddNew rsIssue!SealNo.Value = Me!SealNo.Value rsIssue!Customer.Value = Me!Customer.Value rsIssue!Seal1.Value = Seal rsIssue.Update Seal = DateAdd("d", 1, Seal) Wend rsIssue.Close Set rsIssue = Nothing End Sub
The code however does not work. Thanks in advance.