I have a listbox named listComponents1 and I want the items selected in this by the user to be populated in field Components ID of the table tblMasterData. In my table the field Components ID is of type number. I have written the code but I get an error saying syntax error in Insert Into statement. Can someone help with this issue?
For Each varItem In Me.listComponents1.ItemsSelected
strSQL = "INSERT INTO tblMasterData" & _
"(Components ID)" & _
"Values(" & Me.listComponents1.Column(0, varItem) & ")"
CurrentDb.Execute strSQL, dbFailOnError
Next