Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Filter Form

Posted on 2014-02-26
4
Medium Priority
?
371 Views
Last Modified: 2014-02-26
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
0
Comment
Question by:H-SC
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 2000 total points
ID: 39889060
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
0
 
LVL 1

Author Comment

by:H-SC
ID: 39889173
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?
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 39889268
post the code that you are using (complete)
better upload a copy of your db.
0
 
LVL 1

Author Comment

by:H-SC
ID: 39889410
Ray,
I just got it!  Many thanks for your much needed help!
0

Featured Post

What Is Blockchain Technology?

Blockchain is a technology that underpins the success of Bitcoin and other digital currencies, but it has uses far beyond finance. Learn how blockchain works and why it is proving disruptive to other areas of IT.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question