473,597 Members | 2,375 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with report filter

8 New Member
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.OpenRepor t "MyReport", acViewPreview, , Me.Filter
Else
DoCmd.OpenRepor t "My Report", acViewPreview
End If
End Sub
---------------------------------------------------------------------------------------------------------

Thanks a lot for your help.
Dec 6 '06 #1
7 2354
nico5038
3,080 Recognized Expert Specialist
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
saratogajoe
6 New Member
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 Recognized Expert Specialist
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,566 Recognized Expert Moderator MVP
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,566 Recognized Expert Moderator MVP
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.OpenRepor t "MyReport", acViewPreview, , Me.Filter
Else
DoCmd.OpenRepor t "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 New Member
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,566 Recognized Expert Moderator MVP
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
6466
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 report are based on the same View addressed in the Record Source of both as 'dbo.CLMain_vw'. The View resides in a SQL Server 2000 database. There are two different problems I am having with filtering: The first involves filtering in the form by date...
2
8115
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> COleVariant(_T("HTML (*.html)")), // acFormatHTML
1
2954
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 "onclick" the button it simply prints the order I can see (ie if I've entered Order 0100 - it only prints the one that is open in the form). I want the command button to continue printing but to also send the single page by e-mail. However,...
1
16373
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 VBA to create SQL statements, then apply them. Now that I have been using Access/VBA for awhile, I am wondering if there is a simpler way to do this than coding these long sql statements. My report has a query as its record source. Can I just...
1
1966
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 have set the sort order for the report on descending thus returning the latest records at the top of the report. However since there are well over 6 records related to the account number the report contains all the related records. I have been...
1
5617
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 apply the filters to the fields in the report. I would like to use this form to filter the report within a date range (Raised Date From and Raised Date To), using unbound text boxes, without having to specify the criteria within the report's...
1
1290
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 level return a sales value of $96,000 for a specific office for 2006. Here is my filter, Office = 23
5
6728
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 (SQL -Change Card List). What I want to do is have the form open the report where a filter is set to use the values from the check box AND the value selected from the list box to generate the report. What I can't figure out is how to use the...
3
2638
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 report, filtered, from different forms. How do I carry the name of the current form into the
0
7883
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8379
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8021
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
5842
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5421
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3876
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2393
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1492
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1226
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.