Select Multiple Values from Combo Box

rkm2

New member
Local time
Today, 15:59
Joined
Nov 10, 2007
Messages
4
I currently have a form whose header allows users to select criteria from two unbound combo boxes (with record source based on a table/query) and run a filter command which populates the detail section with a list based on the selected criteria. I would like to have users be able to select multiple values from each combo box.

I have tried using a list box instead of a combo box, but I'm missing something - when I run the filter command I get a message that says "No Criteria." It seems like although I am selecting multiple values I am missing a step.

My Filter Command, if relevant, is as follows:

Private Sub cmdFilter_Click()
Dim strWhere As String
Dim lngLen As Long
Const conJetDate = "\#mm\/dd\/yyyy\#"
If Not IsNull(Me.cboFilterLocalNumber) Then
strWhere = strWhere & "([Local#] = """ & Me.cboFilterLocalNumber & """) And "
End If
If Not IsNull(Me.cboFilterPartyAffiliation) Then
strWhere = strWhere & "([PartyAffiliation] = """ & Me.cboFilterPartyAffiliation & """) And """
End If
lngLen = Len(strWhere) - 5
If lngLen <= 0 Then
MsgBox "No criteria", vbInformation, "Nothing to do."
Else
strWhere = Left$(strWhere, lngLen)
Debug.Print strWhere
Me.Filter = strWhere
Me.FilterOn = True
End If
End Sub
 
When a list box's MultiSelect property is set to Simple or Extended you will no longer be able to access the value property because it doesn't actually have a value. It has an Items Selected collection which you have to iterate through to get the values.

And, in Access, combo boxes do not have the ability to select more than one item.

Check out this post for a sample that might help:
http://www.access-programmers.co.uk/forums/showpost.php?p=627829&postcount=6
 
so...how would you suggest I go about accomplishing my goal? Everything works perfectly except that I want to be able to select more than one value from each field (ie Democrats and Republicans from PartyAffiliation)?

Thanks!
 

Users who are viewing this thread

Back
Top Bottom