samonwalkabout
Registered User.
- Local time
- Today, 23:31
- Joined
- Mar 14, 2003
- Messages
- 185
I have a form with 2 listboxes. i highlight a name in the 1st listbox and click add, a record is added to a many-many link table and the 2nd list box is requeried and reflects this change. All works well but i want to use a multi select box and a select all/add all button. I have read many posts on using multi boxes to pass info to sql but they seem to be realted to searching/ printing reports. Heres the code im using to add the new records.
The table is a simple link table with ref id, eventid, trimid, schid
TrimID links one to many to a table for trimID with staff names
EventID links one to many to a table for EventID with event details.
The code i am using to add one record to this table based on the listbox value is
Dim rst As DAO.Recordset
If Not IsNull(Me.List0) Then
Set rst = CurrentDb.OpenRecordset("tblschedule", dbOpenDynaset)
rst.AddNew
rst.Fields("TrimID") = Me.List0
rst.Fields("EventID") = Me.event
rst.Update
Me.List0.SetFocus
Me.List2.Requery
Else
MsgBox "Please enter a name", vbCritical
Me.List0.SetFocus
End If
ME.Event is a combobox of events
Any ideas on the code needed to add a mutliselection of TrimID's.
Thanks
The table is a simple link table with ref id, eventid, trimid, schid
TrimID links one to many to a table for trimID with staff names
EventID links one to many to a table for EventID with event details.
The code i am using to add one record to this table based on the listbox value is
Dim rst As DAO.Recordset
If Not IsNull(Me.List0) Then
Set rst = CurrentDb.OpenRecordset("tblschedule", dbOpenDynaset)
rst.AddNew
rst.Fields("TrimID") = Me.List0
rst.Fields("EventID") = Me.event
rst.Update
Me.List0.SetFocus
Me.List2.Requery
Else
MsgBox "Please enter a name", vbCritical
Me.List0.SetFocus
End If
ME.Event is a combobox of events
Any ideas on the code needed to add a mutliselection of TrimID's.
Thanks