Solved

Filter Form

Posted on 2014-02-26
4
362 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 119

Accepted Solution

by:
Rey Obrero 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 119

Expert Comment

by:Rey Obrero
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

910 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

19 Experts available now in Live!

Get 1:1 Help Now