selahlynch
Registered User.
- Local time
- Today, 16:56
- Joined
- Jan 3, 2010
- Messages
- 63
I am trying to insert multiple lines into a table using a Multi Select List Box.
The best solution I could come up with was to loop through each selected item and then run an insert query for each loop iteration.
This is not ideal for a few reasons. Is there a better way? Can I combine several entries into one INSERT query, and run DoCmd.RunSQL once only? Any other suggestions?
Thanks
The best solution I could come up with was to loop through each selected item and then run an insert query for each loop iteration.
Code:
For Each rownum In EmpList.ItemsSelected
empIDval = EmpList.Column(0, rownum)
sqlcmd = "INSERT INTO Attendance (EmpID, EventID, DateCompleted) VALUES (" & empIDval & ", 347, '10-jan-2010')"
DoCmd.RunSQL sqlcmd
Next
Thanks
