Hi Guys!
Please can anyone help on the following code
As an attached Invoice form screenshot, I'm trying to Insert the product details from Listbox to the table with a loop as per below VBA, but it is not working.
Please help where I'm going wrong.
Also, I have attached Db, If it requires more details.
Backend table fields & datatypes:
ID: AutoNumber
Inv_No: Short Text
Item_ID: Short Text
Qty: Number
LP: Number
MRP: Number
C_Disc: Number
GST: Number
IGST: Number
LPR_Total: Number
R_Total: Number
Please can anyone help on the following code
As an attached Invoice form screenshot, I'm trying to Insert the product details from Listbox to the table with a loop as per below VBA, but it is not working.
Please help where I'm going wrong.
Also, I have attached Db, If it requires more details.
Backend table fields & datatypes:
ID: AutoNumber
Inv_No: Short Text
Item_ID: Short Text
Qty: Number
LP: Number
MRP: Number
C_Disc: Number
GST: Number
IGST: Number
LPR_Total: Number
R_Total: Number
Code:
Private Sub btn_Save_Click() For i = 0 To ItemsListBox.ListCount - 1 Step 1 CurrentDb.Execute "INSERT INTO tblSE_B( Inv_No, " & _ "Item_ID," & _ "Qty," & _ "LP, " & _ "MRP," & _ "GST," & _ "IGST," & _ "C_Dsic," & _ "LPR_Total," & _ "R_Total)" & _ " VALUES('" & txtInvNo & "','" & _ ItemsListBox.Column(0, i) & "'," & _ ItemsListBox.Column(1, i) & "," & _ ItemsListBox.Column(2, i) & "," & _ ItemsListBox.Column(3, i) & "," & _ ItemsListBox.Column(4, i) & "," & _ ItemsListBox.Column(5, i) & "," & _ ItemsListBox.Column(6, i) & "," & _ ItemsListBox.Column(8, i) & "," & _ ItemsListBox.Column(9, i) & ")" Next i MsgBox "Successfully done", vbInformation, "Sales" End Sub
Comment