When I try adding in another field from my table as a test to the SQL line, I get a "Syntax Error" with the following:
Code:
Private Sub cmdSaveSelected_Click()
Dim strInsertSQL As String
Dim varItem As Variant
With Me.lstProducts
For Each varItem In .ItemsSelected
strInsertSQL = "INSERT INTO Fulfillment(ProductID, Fulfillment Description) VALUES ('" & Me.lstProducts.ItemData(varItem) & "', '" & Me.Fulfillment_Description & "')"
DBEngine(0)(0).Execute strInsertSQL, dbFailOnError
Next varItem
End With
End Sub
It highlights the "DBEngine(0)(0).Execute strInsertSQL, dbFailOnError" line in the code when I click Debug. Do you know where my mistake lies? I've tried several attempts to change things but still get the error.
EDIT: I caught the issue - it was my field naming convention. Having spaces in between field names is a big nono and that was my issue with Fulfillment Description. Now is called FulfillmentDescription and seems to append to the table.