Solved

Filter Form

Posted on 2014-02-26
4
363 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
  • 2
  • 2
4 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
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 …

813 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now