I have users who are using the Sort&Filter options on a from. Specifically they are using the Advanced>>Filter By Form option and then selecting a Vendor and applying that filter to the form.
After this Filter by form is applied they would like to be able to open the a report and have it only show the records they just filtered on.
We are using Access 2013, does anyone have suggestions on how we can accomplish this?
Hi Stang.
I'd do it slightly differently, using Me.Filter, but the results will be the same : - Private Sub Command1680_Click()
-
Call DoCmd.OpenReport(ReportName:="Landscape Data Security Provision Review" _
-
, View:=acViewReport _
-
, WhereCondition:=Me.Filter)
-
End Sub
12 2587 NeoPa 32,556
Expert Mod 16PB
Use the .Filter property of the form in the call to open the report.
So i could do something in the OnLoad Event of the report to reference the form filter?
or can i use the Filter On Load property on the report and set it to yes..but that leaves the question what do i reference in the Filter property on the report?
Actually i figure it out.
I took the underlying query and changed it to have criteria on the vendor field that was looking at the form. So if they sort on the form and go to the report it will be based on what is currently on the report.
NeoPa 32,556
Expert Mod 16PB
I assume somewhere you're using code to open the report. That would be in the format : - Call DoCmd.OpenReport(...)
One of the parameters is called WhereCondition. Simply use the form's .Filter property in there.
NeoPa 32,556
Expert Mod 16PB Stang02GT:
Actually i figure it out.
...
I would recommend you steer clear of such interactions. They make the database objects incestuous in as much as they can only be used together and not flexibly anywhere in your database.
No such issues if the underlying object (QueryDef in this case.) has a filter applied externally.
This is what i am using to try and accomplish what you are saying trying to work through it now. - Private Sub Command1680_Click()
-
Dim fltr As String
-
If Me.FilterOn Then fltr = Me.Filter
-
DoCmd.OpenReport "Data Security Provision Review",acViewReport , , ".Filter"
-
End Sub
This seems to be working well - Private Sub Command1680_Click()
-
DoCmd.OpenReport "Landscape Data Security Provision Review", acViewReport, , Form.Filter
-
End Sub
Thanks for the direction on this Neo!
NeoPa 32,556
Expert Mod 16PB
Hi Stang.
I'd do it slightly differently, using Me.Filter, but the results will be the same : - Private Sub Command1680_Click()
-
Call DoCmd.OpenReport(ReportName:="Landscape Data Security Provision Review" _
-
, View:=acViewReport _
-
, WhereCondition:=Me.Filter)
-
End Sub
This was working great. Now i just got hit with something out the the blue. If you filter by form at the bottom of your form it displays a "OR" tab allowing you to filter the form for a different set of data.
When you apply the filter it brings all the results back to one form but this button i added is not applying the "OR" results to the report.
Would i need to apply multiple filters in this case?
NeoPa 32,556
Expert Mod 16PB
Can you say what the state of Me.Filter is at the time - as well as what filtering you've applied to the form?
I don't filter by form on an existing form but I still can't see why it would resolve to anything different from what's stored in Me.Filter. Strange.
So this issue is actually with the report. The filtering is working as expected.
I needed to remove some code from the report that i had forgotten about that was causing me issues.
Working great now. Thanks again!
NeoPa 32,556
Expert Mod 16PB
8-) Pleased to hear it's all going well now :-)
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Robert Neville |
last post by:
I would like to add filter functionality to my database whether
through the Main form or the subform. This question may be
rudimentary, yet I have not less experience with filtering data
outside...
|
by: mattscho |
last post by:
Hi All, Trying to create a set of 3 buttons in a form that have the same effect as the "Filter by Form", "Apply Filter" and "Remove Filter" Buttons on the access toolbar. Help would be muchly...
|
by: mattscho |
last post by:
Re: Filter By From, Apply Filter, Remove Filter Buttons in a Form.
--------------------------------------------------------------------------------
Hi All, Trying to create a set of 3 buttons in...
|
by: Supermansteel |
last post by:
I am trying to run a Apply filter for everytime someone opens Form_CC it will only show the Test (Test_ID) they are working on. This seems to be the closest I have gotten to filtering it correctly,...
|
by: eHaak |
last post by:
A couple years ago, I built a database in MS Access 2003. I built the form using macros in some of the command buttons, and now I’m trying to eliminate the macros and just use visual basic code. ...
|
by: dbdb |
last post by:
hi guys
need your suggestion
how can i apply filter for my date variable data type
i have a form name transaction
and i have a text box on it named : start and finish
i need to apply...
|
by: dbdb |
last post by:
Hi,
i create a chart in ms access based on my query, then i want my chart when is it open is only show value based on my criteria.
i'll try to used it in the properties apply filter using the...
|
by: Azriel928 |
last post by:
I know this is a simple function to program, but I'm a little rusty. I'm trying to set the "On Open" event on a report using a macro to apply a filter that I have saved as a query.
Can you please...
|
by: Joe Martin |
last post by:
I have a single report with several stats for each line. I would like the user to be able to apply one filter and then be able to apply a second filter to the same report. I have several buttons...
|
by: ka2015 |
last post by:
Good day
I'm Trying to apply filter in Macros in Microsoft Access 2007 but I failed in typing (where condition) in Macros.
I want to create a split form with a search text box above actually...
|
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$) {
}
...
|
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...
|
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
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
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...
|
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,...
|
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...
| |