D
DiverGuy
I'm trying to use the value selected in a combobox to update the selected
items in a listbox. Running into difficulty and all of my local resources
were unable to help. Here's what we're working with:
A table called tblFileList.
A table called tblPerformers
A query called qryFileList that pulls all of the data from tblFileList.
A form with
a multi-select listbox called listboxFileList
a combobox called cboPerformer
and a button called cmdUpdate.
The listbox is populated from the query. The combobox is populated from
tblPerformers.
The goal is to be able to select, say, ten files from the list displayed in
the listbox, select a name from the combobox, click the Update button, and
the Performer field in tblFileList will be updated for those ten files.
I have started an UPDATE statement in the click event for the cmdUpdate
button:
Dim i as variant
For each i in Me.listboxFileList.ItemsSelected
'Nothing is currently in the For..Each statement
Next
Dim strSQL as String
strSQL = "UPDATE tblFileList SET tblFileList.Performer = ' " &
Me.cboPerformer.Value & " ' WHERE XXXXXXXX
DoCmd.RunSQL strSQL
I'm stumbling on the part above indicated by XXXXXXX. Can anyone tell me
how to reference or specify only the files selected in the listbox and update
them in the table?
Any help will be appreciated.
Thanks.
items in a listbox. Running into difficulty and all of my local resources
were unable to help. Here's what we're working with:
A table called tblFileList.
A table called tblPerformers
A query called qryFileList that pulls all of the data from tblFileList.
A form with
a multi-select listbox called listboxFileList
a combobox called cboPerformer
and a button called cmdUpdate.
The listbox is populated from the query. The combobox is populated from
tblPerformers.
The goal is to be able to select, say, ten files from the list displayed in
the listbox, select a name from the combobox, click the Update button, and
the Performer field in tblFileList will be updated for those ten files.
I have started an UPDATE statement in the click event for the cmdUpdate
button:
Dim i as variant
For each i in Me.listboxFileList.ItemsSelected
'Nothing is currently in the For..Each statement
Next
Dim strSQL as String
strSQL = "UPDATE tblFileList SET tblFileList.Performer = ' " &
Me.cboPerformer.Value & " ' WHERE XXXXXXXX
DoCmd.RunSQL strSQL
I'm stumbling on the part above indicated by XXXXXXX. Can anyone tell me
how to reference or specify only the files selected in the listbox and update
them in the table?
Any help will be appreciated.
Thanks.