G
Gnerks
I have a form that has six combo boxes used for filtering information on the
form. They are (in order)
cboScope (Filter options include =ALL, AF, DRU, FOA, MAJCOM) ;
cboMAJCOM (Filter options include = ALL, AF, AETC, ACC, AFMC, …);
cboMRS (filter options include = ALL, 1 MRS, 2 MRS, 3 MRS, …);
cboSTUDY TYPE (filter options include = ALL, CMS, MAS, S/S, FACTORS, …);
cboORG (filter options include: ALL, 2T2, AFSPC, ASU, …);
cboSTATUS (filter options include: ALL, COMPLETE, COMPLETE – IN STAFFING,
PUBLISHED…)
I need to be able to allow the user to filter these combo boxes one at a
time, all at once, or by any combination. For example the user may decide to
filter the cboSCOPE to ‘AF’ and the filter cboMRS to ‘1 MRS’ .
I am not sure how to set my strWhere to allow for the filtering of multiple
combo boxes. I have reviewed Allen Browne’s Client Search information,
however, I remain confused.
Code looks like:
If Me.cboMAJCOM > "ALL" Then
strWhere = strWhere & "([Scope] <> 'ALL') AND "
ElseIf Me.cboMAJCOM = "ALL" Then
strWhere = strWhere & "([Scope] = 'ALL') "
End If
'Remove the ending AND
'See if the string has more than 5 characters (a trailing " AND ") to
remove
lngLen = Len(strWhere) - 5
If lngLen <= 0 Then 'nothing in the string
MsgBox "No Criteria", vbInformation, "Nothing to do"
Else
strWhere = Left$(strWhere, lngLen)
'apply the string as the form's filter
Me.Filter = strWhere
Me.FilterOn = True
End If
Can you help?
form. They are (in order)
cboScope (Filter options include =ALL, AF, DRU, FOA, MAJCOM) ;
cboMAJCOM (Filter options include = ALL, AF, AETC, ACC, AFMC, …);
cboMRS (filter options include = ALL, 1 MRS, 2 MRS, 3 MRS, …);
cboSTUDY TYPE (filter options include = ALL, CMS, MAS, S/S, FACTORS, …);
cboORG (filter options include: ALL, 2T2, AFSPC, ASU, …);
cboSTATUS (filter options include: ALL, COMPLETE, COMPLETE – IN STAFFING,
PUBLISHED…)
I need to be able to allow the user to filter these combo boxes one at a
time, all at once, or by any combination. For example the user may decide to
filter the cboSCOPE to ‘AF’ and the filter cboMRS to ‘1 MRS’ .
I am not sure how to set my strWhere to allow for the filtering of multiple
combo boxes. I have reviewed Allen Browne’s Client Search information,
however, I remain confused.
Code looks like:
If Me.cboMAJCOM > "ALL" Then
strWhere = strWhere & "([Scope] <> 'ALL') AND "
ElseIf Me.cboMAJCOM = "ALL" Then
strWhere = strWhere & "([Scope] = 'ALL') "
End If
'Remove the ending AND
'See if the string has more than 5 characters (a trailing " AND ") to
remove
lngLen = Len(strWhere) - 5
If lngLen <= 0 Then 'nothing in the string
MsgBox "No Criteria", vbInformation, "Nothing to do"
Else
strWhere = Left$(strWhere, lngLen)
'apply the string as the form's filter
Me.Filter = strWhere
Me.FilterOn = True
End If
Can you help?