Hi
I have a Form called FrmAddDueIn which is for adding multiple records into the Table DueInTable. Im using a textbox on the form called AmountTxt to specify the number of records to add when the Button SaveItemsBtn is clicked. I am passing all values to variables before the Loop which contains the insert statement. But this is only saving one record. If I insert a breakpoint on my code(on the loop) and step through the code it asks for the values of the variables. So the values seem to getting cleared after the first iteration of the loop.
Any help would be appreciated.
I have a Form called FrmAddDueIn which is for adding multiple records into the Table DueInTable. Im using a textbox on the form called AmountTxt to specify the number of records to add when the Button SaveItemsBtn is clicked. I am passing all values to variables before the Loop which contains the insert statement. But this is only saving one record. If I insert a breakpoint on my code(on the loop) and step through the code it asks for the values of the variables. So the values seem to getting cleared after the first iteration of the loop.
Any help would be appreciated.
Code:
Private Sub SaveItemsBtn_Click()
Dim CU As String
Dim Man As String
Dim Ty As String
Dim Model As String
Dim PN As String
Dim DI As String
Dim NT As String
Dim Count As Integer
Count = Me.AmountTxt
CU = Me.CustomerCombo
Man = Me.ManCombo
Ty = Me.TypeCombo
Model = Me.ModCombo
PN = Me.PNCombo
NT = Me.NumberTxt
DI = Me.DateDueInTxt
Do
Dim StrSQL As String
StrSQL = "INSERT INTO DueInTable(Customer, Manufacturer, Type, Model, PartNumber, ATRNumber, DueInDate) VALUES(CU,Man,Ty,Model,PN,NT,DI)"
DoCmd.RunSQL StrSQL
Count = Count - 1
Loop Until Count = 0
End Sub