Experts Exchange connects you with the people and services you need so you can get back to work.
Dim varItem as Variant
Dim strSQL as string
for each varItem in me.lstBoxName.ItemsSelected
strSQL = "INSERT INTO yourTable (field1, field2, field3) " _
& "Values(" & me.lstBoxName.column(0, varItem) & ", " _
& me.lstBoxName.column(1, varItem) & ", " _
& me.lstboxname.column(2, varItem) & ")"
currentdb.Execute strsql, dbfailonerror
Open in new window
Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.
Dim intLoop as integer
for intLoop = 0 to me.list2.listcount - 1
strSQL1 = "INSERT INTO Employee_Room_Status " _
& "(L_Name, F_Name, M_Name, Person_Number, Room_ID, Date_Added) " _
& "Values ('" & Me.List2.Column(0, intLoop) & "', '" _
& Me.List2.Column(1, intLoop) & "', '" _
& Me.List2.Column(2, intLoop) & "', '" _
& Me.List2.Column(3, intLoop) & "','" _
& lastID & "',Date())"
CurrentDb.Execute strSQL1, dbFailOnError
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
Please enter a first name
Please enter a last name
Must be at least 4 characters long.
Join and Comment