Modules & VBA :: Setting Subreport Filters From Parent Filter

Apr 24, 2015

I have a report which is opened using a DoCmd.OpenReport. There's a criteria string which filters the main report - this works fine.

There's now a requirement to place a summary subform at the beginning of the report, in the report header. I need that summary to use the same criteria string as the main report.

For the main report's OnLoad I put : Me!Expenditure_By_Type_Subreport.Report.Filter = Me.Filter

But I get the error message:

Error 2101. The setting you entered isn't valid for this property.

I tried it the other way round as well - in the OnOpen of the subreport I tried : Me.Filter = Me.Parent.Filter

And it gives the same error.

When I just a manual Filter change such as : Me.Filter = "Project_ID Is Not Null"

View Replies


ADVERTISEMENT

Modules & VBA :: Combo Filters That Filter One After The Other

Mar 12, 2015

I have a set of combo filters that filter one after the other as follows -

If Not IsNull(Me.NameFilterBox) Then
If Me.Form.Filter="" Then
Me.Form.Filter="Name ='" & Me.NameFilterBox & "'"
Else
Me.Form.Filter = Me.Form.Filter & " and Name = '" & Me.NameFilterBox & "'"

[Code] .....

and the I use the

Me!Form.Filter = Me!Form.Filter & " and Name = '" & Me!cboOPOwner.Text & "'"

to filter down so the user can work with what they filter, my question is how can I add on a filter that filters between dates? and second I was hoping that I could program the filters so that they could be changed individually/randomly as to filtering one after the other and then clearing to restart the filtering again ...

View 11 Replies View Related

Modules & VBA :: Can Filter Child Subform From Parent Form?

Jun 11, 2013

I am updating an existing database and I have a parent/child form and I want to filter the subform for the current parent form record? The two forms are linked together by woWorkOrderID/deWorkOrderID.

View 1 Replies View Related

Modules & VBA :: Setting Filter On A Form With Variables

Aug 26, 2014

I am trying to set a filter on a form with VBA using variables and having no success at all. The code I tried last, which seemed to be "close, but no cigar", was:

Code:
Dim sFilterValue As String
Me.FilterOn = False
sBiller = Me.txtbiller.Value
sLastSource = Me.txtbiller.ControlSource
sLastSource = "[" & sLastSource & "]"
sFilterValue = sLastSource & "=" & sBiller
Me.Filter = sFilterValue
Me.FilterOn = True

sLastSource and sBiller are global variables. When I debug this code the sFilterValue is exactly what I would plug in manually and the Me.Filter shows up as "[Field Name] = Filter Value". But it crashes on Me.Filter = sFilterValue. I have tried all sorts of combinations but nothing I've tried works. What is the proper syntax for using variables as filters?

View 2 Replies View Related

Modules & VBA :: Setting Filter Property Via On Open Event Of A Report

Dec 15, 2014

I have a report, on a control tab, on a main form.

On the form are two buttons: one to show all items, and one to filter them based on a boolean field called showitem.

The buttons work with the code below.

What I want to do but cannot seem to figure out is to have the report default to no filter.

The bound query has no criteria.

I'm trying to set the filter property via the on open or on load event and even if I isolate the report, cannot seem to reach it.

Code:
Private Sub b_hide_items_Click()
Me.Profile_Timeline_wNotes_subreport.Report.Filter = "timeline.showItem <> 1"
Me.Profile_Timeline_wNotes_subreport.Report.FilterOn = True
Me.Profile_Timeline_wNotes_subreport.Requery
End Sub

Private Sub b_show_all_Click()
Me.Profile_Timeline_wNotes_subreport.Report.Filter = "timeline.showItem = 0"
Me.Profile_Timeline_wNotes_subreport.Report.FilterOn = False
Me.Profile_Timeline_wNotes_subreport.Requery
End Sub

View 14 Replies View Related

Reports :: Setting Subreport Source Object To A Report In A Collection

Apr 6, 2013

I am trying to join a number of reports into one report. I have a generic report which displays a different dataset given the user's choice on a form. I created a collection where I can store multiple instances of this report (called mcolReportInstances) - this works just fine.

I was looking to combine all the reports in the collection into one report. To that end, I have created a report with a number of subreport controls but with no sourceobject. In the On_Open event of this blank report, I am trying to set the source object of the subreport to one of reports in my collection:

Me.Controls("Child" & i).SourceObject = mcolReportInstances.Item(strKey)

However, it keeps giving me the error 'Type mismatch'.

View 10 Replies View Related

SubReport Filter

Mar 21, 2006

I have a report open that contains a subreport. I am trying to run the following code from a form to change the filter on this subreport.

Reports("rptStaffDetail").Controls("rptStaffReportSub").Report.Filter = "MasterCourseType = 1"

I get the error 'The setting you entered isn't valid for this property'

I should be able to access the subreport this way as the following code ran from the form works fine.

Reports("rptStaffDetail").Controls("rptStaffReportSub").visible = False

View 2 Replies View Related

Reports :: Setting Filters - Updating On Multiple Sub Reports?

Apr 26, 2015

I have created a report which contains within it multiple sub-reports, which I use to generate a document for management meetings on a bi-weekly basis.

For each of these I have the subreports filtered to a unique number for consideration that period e.g. LIKE "88/00039" which relates to my data.

In order to change this I have to manually update each of the filter commands within the subreports but I assume there must be an easier 'catch-all' method of achieving this?

Ideally I'd be looking for a command prompt so I could enter just the number sequence e.g. "88/00040" and then enter this (via a corresponding macro or similar) to update the filter commands.

View 2 Replies View Related

General :: Setting Filter With VBA?

Aug 19, 2014

I'm trying to set a filter with a command button. I've tried to do it like the examples I've read on numerous sites, but I can't seem to get the filter set. The code that seems most like the examples to me is:

Me.Filter = "[chkPaid] = 0"
Me.FilterOn = True

When I run this I get a box telling me to enter a parameter value for chkPaid. chkPaid is definitely the correct name for the checkbox control on the form. I've tried many variations with and without the square brackets, but as long as I have [chkPaid] inside of quotes I get the Enter Parameter box. If I leave the quotes off I get no parameter value request, but it doesn't set the filter either.

View 3 Replies View Related

Modules & VBA :: Export To Excel With Filters

Aug 30, 2014

I'm trying to create a button that will export the filtered records on the screen to an Excel file.

I'm using strWhere as my where string and found this code in one of the posts from this forum, but unfortunately, I can't get it output only the filtered records. It outputs all records instead.

Dim db As dao.Database, qdf As QueryDef, mySQL As String
Dim strWHERE As String
Const strSQL = "SELECT * FROM [Action Register] "

[Code].....

View 11 Replies View Related

Modules & VBA :: Date Filters Using Combo Box

Mar 21, 2015

I have a set of combo filters that filter one after the other as follows –

Code:
Private Sub cboCity_AfterUpdate()
If Nz(Me.cboCity.Text) = "" Then
Me.Form.Filter = ""
Me.FilterOn = False

[code]...

and so on to filter down so the user can work with what they filter, my question is how can I add on a filter that filters between dates? and second I was hoping that I could program the filters so that they could be changed individually/randomly as to filtering one after the other and then clearing to restart the filtering again if that makes sense. I have tried using this, but it doesn’t work ‘Bad Command’

Code:
Me.Form.Filter=”StartDate =#” & Format(Me.txtStartDate, “mm/dd/yyyy”) & “#”

And

Code:
Me.Form.Filter=”EndDate =#” & Format(Me.txtEndDate, “mm/dd/yyyy”) & “#”

View 4 Replies View Related

Modules & VBA :: How To Enable Multiple Filters

Apr 17, 2015

I have a form where I have buttons that apply filter to a certain column.How do I enable multiple filters where I can click more than 1 filter button and it keeps the filters?

First filter button:

Private Sub Command1_Click()
DoCmd.ApplyFilter "Filter1", "[MyQuery]![Checkbox1]=Yes", ""
End Sub

Second filter button:

Private Sub Command2_Click()
DoCmd.ApplyFilter "Filter2", "[MyQuery]![Checkbox2]=Yes", ""
End Sub

Third filter button:

Private Sub Command3_Click()
DoCmd.ApplyFilter "Filter3", "[MyQuery]![Checkbox3]=Yes", ""
End Sub

It works well, but one by one. How can each next filter be added to previous filters by clicking filter button on a form?

View 2 Replies View Related

Setting A Filter On Dynamically Created Table?

Apr 23, 2015

I am currently working on a Database to automatize some process.

The User can import a CSV (Text) File via a DialogBox, which gets imported into a Table. After this, the content has to be filtered, setting conditions on 4 different rows. The new Table gets exported into a new CSV (It has to be CSV, since it later gets imported into SAP)

How can I set a Filter on a dynamically created Table (using VBA)?

Best case would be to save the filter into my Import spec, but Access doesn't seem to have this option (?)

View 3 Replies View Related

Modules & VBA :: Filters Not Working For Multiple Users

Mar 9, 2014

I have created a module, where based on various selections (form), the output is thrown in the table for editing various fields. This works fine with single user. But once I have placed the same database on the share drive for multiple users, the users are unable see the data in the text filters. I don't know what is the issue all about. Also if i use me.requery, the text filters becomes blank. Below is the code :

Code:
Option Compare Database
Option Explicit
Public Function SelRec(shDate As Date, ATMID As String, City As String, Depots As String, Vendor As String) As Boolean
SelRec = False

[Code] .....

View 12 Replies View Related

Setting Numbers Equal To Words To Filter Forms?

Sep 19, 2014

I'm working on a form that when opened has a pop up filter that asks you to enter "1, 2, 3, 4 or 5". These numbers have to be equal to an actual word within the form. For example, on the form we have a box called "business unit". One of the options in "business unit" is "Human Resources".

I want to set 1 = to Human Resources so that way in the filter box all a person has to type is 1, and all of HR's records will pop up. The reason for this is we are trying to eliminate typing as much as possible.

View 1 Replies View Related

Filter Parent Data By Child Data?

Jul 11, 2006

All,

Is it possible to filter parent records by child records (or subdata) without showing multiple instances of the parent data in the form/query?

Cheers,

Bobadopolis

View 2 Replies View Related

Modules & VBA :: Date Filters - Work Load Criteria

Mar 25, 2015

I know in Access that you can filter your work load criteria for each employee which is fine using Como boxes to filter down specific criteria for that employee, however I'm trying to achieve it with date filters between certain dates, and it works but ends up filtering the dates for every employee, I just want it to filter that specific employee .

This is what I have so far.

PHP Code:

 Private Sub Date_Filter_Click()     
Dim strWhere As String    
Dim lngLen As Long    
Const conJetDate = "#mm/dd/yyyy#"           
If Not IsNull(Me.txtStartDate) Then        

[Code] ....

View 2 Replies View Related

Modules & VBA :: Form With Multi-criteria Searches / Uses Strings And Filters

Jan 23, 2014

I have a search form with blank fields tied to a table, four criteria search boxes, and a button to take the input from the search boxes, search the table, and populate the results on the form's blank fields. As of now, it works as long as all four criteria boxes aren't null.I used filters to achieve this, and here's the code that works as long as all four boxes are not empty. (My criteria boxes are as follows: a textbox called "Keyword" and three combo boxes called HRCombo, BuildingCombo, and RoomCombo, and the fields they're tied to are as follows: "Item Description" "HR Holder" "Building" "Room") My first line "Me.Filter = ..." was broken up to make it easier to view.

Code:

Me.Filter = "[Item Description] Like " & Chr(34) & Me.Keyword & "*" & Chr(34) & "
AND [HR Holder] = '" & Me.HRCombo & "'" & " AND [Building] = '" & Me.BuildingCombo
& "'" & " AND [Room] = '" & Me.RoomCombo & "'"
Me.FilterOn = True
Me.Requery

I need it to be able to do the search no matter which combination of criteria boxes have input. Someone recommended using if statements to do the following: Create four strings, one for each criteria box. Use 4 if statements to check if the box is null - if it is null, assign an asterisk to its string, and if its not null, assign the value I used for the above Me.Filter statement to each box's string. Then, use Me.Filter and concatenate the four strings at the end. Here's the code I used for this, and, with my limited knowledge, I can't get it to work.

Code:

Dim StrA as String, StrB as String, StrC as String, StrD as String
If Me.Keyword is null then
StrA = "*"
else
StrA = [Item Description] Like " & Chr(34) & Me.Keyword & "*" & Chr(34)
End If

[code]....

View 14 Replies View Related

Modules & VBA :: Object Missing Error On Code To Apply Two Filters

May 12, 2015

I've got a form that takes the members from my members table and allows me to take attendance. I have it set up with toggle buttons in the footer (so we can see what class we're currently looking at) and I want to apply two filters when we click on a button. The two filters are "SS_Roll = Yes (or True)" and "SS_Class = AD1 (or whatever the class is)". I did some research and found one code for it, but now that I'm getting the missing object error and upon further research, I'm starting to think the code I found was only an excerpt. Below is the code I currently have. It highlights the first line when I hit debug.

Code:

Private Sub OptAD1_Click()
Table![MembersTable].FilterOn = True
Table![MembersTable].Filter = "[SS_Roll] = " & True And "[SS_Class] = " & AD1
End Sub

View 11 Replies View Related

Modules & VBA :: Use Parent Form Value In Subform Calculation

Nov 19, 2014

I have a parent form where I enter a value for tax rate. I need to use this value in the tax calculation in the subform fields i.e. subform.taxdue = subform.qty * subform.price * parent.taxrate.

I can get the value into the field. But I do not think I am putting it in the correct event. The parent form is a sales form and the subform is the sales items form. So there can be multiple items on the sub form.

View 5 Replies View Related

Modules & VBA :: Open Report With Subreport Based On Unbound Form

Apr 14, 2015

I am trying to open a report (rptGMX-IRG) that includes a sub-report (srptRG) based on criteria that is set with two unbound fields on a form (frmGMXbook). This form has two dropdown boxes (cboGMX_No & cboMachSize) and a command button. The first dropdown box includes data located in the main form and the second dropdown includes data that is part of the sub-report.

I can get the report to open properly when I enter data into both fields on frmGMXbook.

However, the problem I am having is the inability to have one or both fields be "Like '*'" and show all associated records.

Here is the code I have on the command button.

Private Sub GMX_Preview_Click()
Dim strCriteria As String
If IsNull(Me.cboGMX_No) Then
strCriteria = "[cboGMX_No] Like '*'"
Else
strCriteria = "[GMX_No] ='" & Me.cboGMX_No.Value & "'"

[Code] ....

View 1 Replies View Related

Modules & VBA :: Display Some Results In Subreport But Keep Grand Total Of Report Itself

Oct 25, 2013

How to display only the first few records in a subreport but keep the grand total of the report itself. When I limit results in query; it gives me the records but only totals for that set. I thought about putting code in the on format in detail section like:

Code:
If me.control.value >10 then
me.control.visible =false

but doesn't work.

View 4 Replies View Related

Modules & VBA :: Export Subreport To Excel - Object Defined Error

Apr 13, 2015

I have used the following script to export a subform to excel but it isn't working for a report.

The report name is spelled correctly etc... but the error message keeps saying error 2465 or if I enable the error handler it says application defined or object defined error.

I don't want to have to export the data to a table first, but if I have to then I guess I will have to.

Code:
Sub fFunctionNameExportExcel(ctrl As IRibbonControl)
'print to excel
Dim rst As DAO.Recordset
Dim ApXL As Object
Dim xlWBk As Object
Dim xlWSh As Object
Dim fld As DAO.Field
Const xlCenter As Long = -4108

[Code] ....

View 3 Replies View Related

Modules & VBA :: Referencing Parent Form On Requery - Error 2450

Apr 3, 2014

In short, here is what I am trying to accomplish:

1. I have a two-tier, tabbed Navigation form (Menu-Main).

2. One of the second-tier tabs opens a form (VendorMain) which displays a Datasheet based on [Query.Vendor_Query]

3. VendorMain contains a Command Button (EditButton), which calls a subform (VendorForm) used for editing.

4. Upon saving the edits, VendorForm's OnClose event is supposed to Requery the datasheet on VendorMain, so the edits are reflected when the user returns.

I have tried over a dozen different permutations of the following, but nothing seems to work:

Me!Parent.Requery
Forms!VendorMain.Requery
Forms![Vendor_Query].Requery
Forms!Main-Menu!VendorMain.Requery
Etc...

VendorForm opens, edits, saves and closes perfectly. However, I consistently get the following error and the parent form is not requeried:

Runtime Error 2450 - Cannot find the referenced form VendorMain

Code available upon request.

View 4 Replies View Related

Modules & VBA :: Subform Calculations Based On Parent-form Data?

Jul 17, 2013

I have a form with a subform in a navigation menu. Something like:

Navigation Form
NavigationSubform
ParentForm (header data and some unbound calculation fields)
Subform (Multiple lines tied to query)

I have some fields in the ParentForm (i.e PF1, PF2) that would effect the values on the Subform (i.e. SF1, SF2). Also, there are some user editable values on the subform that will calculate the remaining fields on the subform (still using data from parentform).

My calculations work fine for the changes made on the subform. However I need to be able to calculate all the children lines on the subform when the form loads or a change is made to certain fields on the parentform. My On_Current event only wants to recalculate the first line.

Parent Form
PF1=10
PF2=3
Subform QTY ADJ SF1 SF2
Line 1 5 .05 10.6 112.89
Line 2 8 .14 10.38 105.15
...
Line N
SF1=PF1+(PF2/QTY)
SF2=SF1*(SF1+ADJ)

So if PF1 or PF2 were changed then all the lines is subform would recalc SF1 and SF2. If changes were made to QTY or ADJ, then that line would recalc SF1 and SF2.

View 3 Replies View Related

Modules & VBA :: Filter Records - Adding Unbound Date Listbox To Filter String

Feb 10, 2014

I'm trying to hash two scripts I've found into 1 functioning filter, however I'm still relatively new to vba and can't figure out how to get this working.

I'm trying to use Allen Browne's Search Criteria:

with another snippete of code I found here:

Code:
'Purpose: This module illustrates how to create a search form, _
where the user can enter as many or few criteria as they wish, _
and results are shown one per line.

[Code]....

It's the date part I'm having trouble with, the rest of the search criteria work fine without the date, but I can't get it working when I try to modify and merge the date sections of each code.

Also I'm using a listbox for the "Yesterday";"Last 4 days";"Last 9 days" and not a combo box.

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved