473,396 Members | 1,712 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,396 software developers and data experts.

Problem with report filter

8
I set up a form for searching criteria and pass the searching result to a report. On this report there is an unbound text box (=[Report].Filter) and shows the searching criteria. It works fine when searching criteria is NOT NULL. But when Seaching criteria is Null, it will show some incorrect default filter.

I think the problem might be solved by using IIF( Report.filteron, Report.filter, Null). But I don't know how to set Report.filteron=True.

Here is my code to open the report
----------------------------------------------------------------------------------------------------------
Private Sub test_Click()
If Me.FilterOn Then
DoCmd.OpenReport "MyReport", acViewPreview, , Me.Filter
Else
DoCmd.OpenReport "My Report", acViewPreview
End If
End Sub
---------------------------------------------------------------------------------------------------------

Thanks a lot for your help.
Dec 6 '06 #1
7 2341
nico5038
3,080 Expert 2GB
The report's FilterOn will be set to True by Access when opening the report with the criteria. When they are missing the FilterOn will be False.

Your code looks like the code I use in similar cases, what goes wrong ?

Just make sure that you didn't create a filter in the designmode and use no Null but:
=IIF( Report.filteron, Report.filter, "")

Nic;o)
Dec 6 '06 #2
The report's FilterOn will be set to True by Access when opening the report with the criteria. When they are missing the FilterOn will be False.

Your code looks like the code I use in similar cases, what goes wrong ?

Just make sure that you didn't create a filter in the designmode and use no Null but:
=IIF( Report.filteron, Report.filter, "")

Nic;o)
This report would fit nicely into an application I am doing, but I would like to know how to create the form and pass the results to a report
Thanks
Dec 6 '06 #3
nico5038
3,080 Expert 2GB
Bit confusing to have two questionners in one Q.
Best would be to post a new question to keep the replies clear.
The posted code by the questioner is placed behind a form that has the ability being filtered e.g. by using the right-click popup menu.
The filter button will look pressed when a filter is active and the form's Filter property will hold a string like "[ordernumber]=12345".
Such a filter can be passed to a report straight away.

Personally I use in general a datasheet subform and pass the filter of such a subform to a report by a button press. Check the filter samples at www.geocities.com/nico5038

Nic;o)
Dec 6 '06 #4
NeoPa
32,556 Expert Mod 16PB
This report would fit nicely into an application I am doing, but I would like to know how to create the form and pass the results to a report
Thanks
SaratogaJoe,

Please post a new thread if you have a question.
Hi-jacking someone else's thread is frowned upon in these forums as it makes the job of helping more difficult.

MODERATOR.
Dec 6 '06 #5
NeoPa
32,556 Expert Mod 16PB
I set up a form for searching criteria and pass the searching result to a report. On this report there is an unbound text box (=[Report].Filter) and shows the searching criteria. It works fine when searching criteria is NOT NULL. But when Seaching criteria is Null, it will show some incorrect default filter.

I think the problem might be solved by using IIF( Report.filteron, Report.filter, Null). But I don't know how to set Report.filteron=True.

Here is my code to open the report
----------------------------------------------------------------------------------------------------------
Private Sub test_Click()
If Me.FilterOn Then
DoCmd.OpenReport "MyReport", acViewPreview, , Me.Filter
Else
DoCmd.OpenReport "My Report", acViewPreview
End If
End Sub
---------------------------------------------------------------------------------------------------------

Thanks a lot for your help.
As Nico says, there isn't a better way than what you already use.
Like you, I feel there aught to be but I've never found one :(.
Dec 6 '06 #6
fleece
8
Hi, Nico,
Thanks for your reply. I tried to use IIF as you suggested. However, it won't show any criteria evenif there is some searching criteria. So I guess the Report.FilterOn is False. What's wrong? Very confused.
Thanks again for your contribution.

The report's FilterOn will be set to True by Access when opening the report with the criteria. When they are missing the FilterOn will be False.

Your code looks like the code I use in similar cases, what goes wrong ?

Just make sure that you didn't create a filter in the designmode and use no Null but:
=IIF( Report.filteron, Report.filter, "")

Nic;o)
Dec 7 '06 #7
NeoPa
32,556 Expert Mod 16PB
Do you have controls on your form called 'Filter' and 'filterOn'?
If not then you won't have anything to refer to.
Tell us what you do have and we can see if we can help with more detail.
Remember, we can only use any details you've already told us about. Otherwise we have to refer to things generically (like Report. etc). Does that make sense?
Dec 7 '06 #8

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

Similar topics

0
by: CSDunn | last post by:
Hello, I have a problem with field filtering between an Access 2000 Project form (the application is called CELDT), and the report that shows the results of the filter. Both the form and the...
2
by: Vikrant | last post by:
Hey Friends I need to export an Access Report using a filter. I am using the method OutputTo m_pDoCmd->OutputTo( 3, // asOutputReport COleVariant(strReportName), // <report name>...
1
by: John Taylor | last post by:
I have finally got "SendObject" to work but now have a filter problem. I have a database set up that I generate orders and print them as a single page report. I've set up a filter so that when I...
1
by: lorirobn | last post by:
Hi, I have a report that works just fine. Now I would like to add the capability to choose selection criteria to limit what is displayed. I created several reports that do this, but they used...
1
by: dfw1417 | last post by:
I have used a query and report filter to return records related to a specific account id. I want to print a report including only the latest 6 records out of the set returned by the record filter. I...
1
by: Cara Murphy | last post by:
Hi There! Hoping you are able to help me with a filtering scenario: I have created a pop up form (Filter) to filter a report (Open Issues), which currently has a number of combo boxes which...
1
by: AF | last post by:
I am having a problem with several reports at work. We use an SQL generator package where we fill in a template, and the system generates SQL code. The reports I have been running at a low...
5
by: Andrew Meador | last post by:
I have a form (Change Card List by Status) with a check box (cboNOT) and a list box (lstStatus). There is an Open Report button that opens a report (Report - Change Card List) which uses a query...
3
by: franc sutherland | last post by:
Hello, I have a report which I filter using the me.filter command in the OnOpen event. Me.Filter = "OrderID=" & Forms!variable_form_name! Me.FilterOn = True I want to be able to open that...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: 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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.