Filter Form

H-SC
H-SC used Ask the Experts™
on
I have a form that has detail records.  I have 2 combo boxes that I would like to use to filter the detail records on the form with.  I have tried the following and does not seem to work.  How can this be done?

Dim strFilter As String
Dim strFilter2 As String
strFilter = "Make = '" & Combo136.Value & "'"
strFilter2 = "Type = '" & Combo138.Value & "'"
Me.Filter = strFilter
Me.Filter = strFilter2
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2016
Commented:
Dim strFilter As String
strFilter=""

if me.Combo136 & ""<>"" then
strFilter = "[Make] = '" & Combo136.Value & "'"
end if
if me.Combo138 & ""<>"" then
     strFilter="" then
     strFilter = "[Type] = '" & Combo138.Value & "'"
     else
     strFilter = strFilter  & " And [Type] = '" & Combo138.Value & "'"
end if

Me.Filter = strFilter
me.filteron=true

Author

Commented:
Rey,
Many thanks.  I tried the code but it looks like the results are only getting filtered to the type filter and not both (type and make).  Any ideas?
Top Expert 2016

Commented:
post the code that you are using (complete)
better upload a copy of your db.

Author

Commented:
Ray,
I just got it!  Many thanks for your much needed help!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial