Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

help with multi select list box

Status
Not open for further replies.

mrbboy

Technical User
Feb 28, 2007
136
US
I have a form, frm_Main, with three subforms. One of the subforms, sfrm_Service, contains a multi select list box. This list box shows all the possible repairs that can be done on a particluar instrument. I want the user to be able to click all that is done. I also placed a command button, cmd_Add, on the main form to add the records. I am using the following code to add the records in the sfrm_Service list box but nothing happens. Please help.

Dim db As Database
Dim rec As Recordset
Dim varSelected As Variant

Set db = CurrentDb()
Set rec = db.OpenRecordset("tbl_Service")

'Add Records
For Each varSelected In Me!list_Service.ItemsSelected
rec.AddNew
rec("DeptService") = Me!list_Service.ItemData(varSelected)
rec.Update
Next varSelected

db.Close
Set db = Nothing
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top