I can store records in a database using combobox with the following code. Here, the number of one part is selected, and the data associated with it is stored in the database table.
But I want code for a Listbox ... When I select multiple partnumbers .. how can I save to a DB table?
Case "Pn ADDED to Wrapper", _ "Pn REMOVED from Wrapper" If Me!PartNumber <> "All" And Me!PartNumber <> "Select" Then ' a proper part number has been selected in combo box strNewSq5 = _ "INSERT INTO tblTmpEventLog (TrackingNumber,PartNumber,PartNumberChgLvl,EnteredBy,EventTypeSelected,EventDate)" strNewSq5 = strNewSq5 & " VALUES ('" & tempTrackingNumber & "','" & _ tempPartNumber & "','" & _ tempPartNumberChgLvl & "','" & _ tempEnteredBy & "','" & _ tempEventTypeSelected & "'," & _ "#" & Forms!frmEventLog_Input.EventDate & "#)" dbs.Execute strNewSq5, dbFailOnError TrnsfTmpEventToEventLog Else displayMsgBox = MsgBox("A single part number must be specified. Please correct.", vbCritical, "System Error") Exit Sub End If
source share