Multi Selections from List passed to Query

  • Thread starter Thread starter Paul Cross
  • Start date Start date
P

Paul Cross

I've got a form ("Select Multiple Departments") with a multi-select
list box ("cboMultipleDepartments").
I intend to use some code I found that loops through the selected
values and assigns them to a hidden field's control source
("ctlHiddenString")
I then have a query "qryMultipleDepartments" that uses that hidden
field as a criteria for selection.
My first attempt is to get this running w/ just 1 selection and try
the loop later. But I'm getting "Object Errors" and am not sure I've
got the code attached to the right events ...

My code is attached to the onClick event of a command button:

Private Sub cmdMultipleDepartments_Click()

Dim stDocName As String

'this next part I'd like to assign multiple select values.
'But I can't even get anything assigned (e.g. a constant)

Set ctlHiddenString.Value = HELPmeASSIGNsomethingHERE

'Then I would just open the query, where the text box
'ctlHiddenString provides criteria

stDocName = "qryInvestigate_Filtered_Multiple_Departments"
DoCmd.OpenQuery stDocName, acPreview


End Sub

When I click the command button with the above code i get "Object
Required"

Thanks for any suggestions
Paul Cross
 
Back
Top