473,387 Members | 1,516 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Report Filtering

174 128KB
Currently I have a report created from a query with a filter based on a single unbound listbox which is working. I tried to add a second unbound listbox for additional filtering but it is not functioning - no errors just literally seems to do nothing. The code that does nothing is a replica of the posted working code with exception of the control names. Any suggestions would be appreciated. Thanks
Expand|Select|Wrap|Line Numbers
  1. 'Private Sub listbox_AfterUpdate()
  2. '      If listbox= "ChoiceA" Then
  3. '        DoCmd.SetFilter WhereCondition:="[txtcontrolname] Like ""ChoiceA*"""
  4. '      ElseIf listbox= "ChoiceB" Then
  5. '        DoCmd.SetFilter WhereCondition:="[txtcontrolname] Like ""ChoiceB*"""
  6. '      ElseIf listbox= "ChoiceC" Then
  7. '        DoCmd.SetFilter WhereCondition:="[txtcontrolname] Like ""ChoiceC*"""
  8. '      ElseIf listbox= "ChoiceD" Then
  9. '        DoCmd.SetFilter WhereCondition:="[txtcontrolname] Like ""ChoiceD*"""
  10. '      Else
  11. '        DoCmd.SetFilter WhereCondition:="[txtcontrolname] Like ""*"""
  12. '    End If
  13. 'End Sub
  14.  
Feb 20 '22 #1
1 4603
NeoPa
32,556 Expert Mod 16PB
Two tips :
  1. Instead of using the DoCmd.SetFilter to set the filtering of your Report, use the .Filter & .FilterOn properties of the Report itself.
  2. If you want the Report to recognise two separate controls for filtering then you should create a string value that does that and then allpy it. In very rough format that would look like :
    Expand|Select|Wrap|Line Numbers
    1. ([FieldA]='Value A') AND ([FieldB]='Value B')
    You'd obviously need to build up the string based on the values of your filtering Controls.
Feb 21 '22 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Johan | last post by:
I have a form, with subforms, wherein I use a filter to select certain records. Then I can browse trough the selected records, and, if nessecary, change them. The form is based on a table with...
1
by: diskoduro | last post by:
Hi! I'm trying to get help to an unexpected problem that has appeared while I was writing a new application. I want to opeon a report of product sales by filtering previously from a listbox in a...
16
by: Nhmiller | last post by:
I already have a report designed under Reports. When I use filtering in Forms or Tables, I see no way to select that filtered list when I am in Reports, and there appears to be no way to do the...
8
by: Armando | last post by:
Here's one that's going to leave me bald before long - I have a report (no headers or footers, small detail section) that runs normally when I open it from the database window. When I run it...
15
by: Richard Hollenbeck | last post by:
I tried to ask this question before on the 14th of January but I never got a reply. I'm still struggling with the problem. I'll try to rephrase the question: I have a crosstab query with rows...
2
by: Denise | last post by:
How do I get the report to not spend time pulling up the data when I'm going to bail out of the report anyway? Below is the code in my report. I first show the user a form where they can select...
0
by: AA Arens | last post by:
I have a create report function showing reports for every record that is listed in the tblCalls table. In my situation one report per call that comes from a company. I would like to have a...
1
by: jmarcrum | last post by:
Hey everyone... I have a report with 4 labels on it at the top. The first label is lblSunday1, the second is lblSunday2, and so forth... I have a small form in my Database called frmReports. ...
2
by: Vaulcul | last post by:
Hello, I have a report that is supposed to show the teachers that have taught specific classes this year. I'm almost done, I just need the report to filter the data before opening. In setting...
14
Brilstern
by: Brilstern | last post by:
This question directly relates to the same data in this Post. Scenario: I am trying to create a form that allows me to filter a dataset at a very granular level. To do this I need to be able to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.