Solved

Filter Form

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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

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.
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

617 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