Form, Main Report And Subreport Filtering
Jul 6, 2005
Below is the working version of the code works for single report filtering. say a report called "rptduedate_census2" and i can filter out using form instead of hard coding query of that report (say lastname=form!frmsample!txtlastname). I dont want to hard code query and there are reasons for that.
I am using a Main report called "rptDueDates_Dept' and there are about 10 different subreports (see print screen). The main report is not bound to any query. It has many subereport. Each subreport is bound to some query and i need to be able to filter them before data appear on the main report. Am i making any sense, LOL.
How can I implement my working code below to do this. PLEASE PLEASE PLEASE HELP. I AM NEW TO ALL THIS. I have attached a print screen of the main report, just to show how i put subreports in their.
===== MY WORKING CODE ======
Private Sub cmdPrv_Click()
Dim strFilter As String
strFilter = "[Mail_Census_Date] BETWEEN #" & txtStartDate & " # AND # " & txtEndDate & " # "
' Apply the filter and switch it on
If SysCmd(acSysCmdGetObjectState, acReport, "Report") <> acObjStateOpen Then
DoCmd.OpenReport "rptduedate_census2", acViewPreview
With Reports![rptduedate_census2]
.Filter = strFilter
.FilterOn = True
End With
DoCmd.Restore
Exit Sub
End If
End Sub
View Replies
ADVERTISEMENT
Jan 12, 2015
I have a main report with one subreport. The main report contains details of a payment being made to a supplier. There is the total amount being paid, and the cheque number being transferred. There is also a field called payref which is made invisible. This is used to link up with the subreport. The amount is the total of several invoices for which payment is being made.
The subreport contains details of each of a number of the invoices being settled. The subreport is linked to the main report via a common field called pay-ref, and the subreport is 'visible'. The subreport prints when placed in the page header section of the main report. However when there is a large number of invoices being shown in the subreport only a certain number appear. It appears that the subreport can only hold a certain number.
When the subreport is put, as it should, in the detail section of the main report, it does not appear at all in the main report. I have no clue why and I have made several reports like this one before.
View 2 Replies
View Related
Dec 13, 2013
Access 2007
Windows 7
Trying to get a subreport total to show on my main report
getting #error no matter how I code
Running a subreport containing a total in report footer (only field that
name of subrpt total fld subrpt
[SubRptExp].[Report]![gramtrcvd]
View 9 Replies
View Related
Jul 30, 2015
I am trying to get my totals from my subreports, and dividing the number by 2 or 4, and put the new number on the main report.
for Operator/Trainer Productivity, I used:
=([rptEmployEvaluationOperator subreport].[Report]![OPTotal]+[rptEmployEvaluationOperatorTrainer subreport].[Report]![OPTotal])/2
for Auditor/Trainer Productivity, I used:
=([rptEmployEvaluationAuditor1 subreport].[Report]![OPTotal]+[EmployEvaluationAuditor2 subreport].[Report]![OPTotal]+[EmployEvaluationAuditor3 subreport].[Report]![OPTotal]+[EmployEvaluationAuditorTrainer subreport].[Report]![OPTotal])/4
These both work if there are values in all totals subreports. When one of them might not have a total, I get an error message.
I tried to use :
=IIf([Orders].[Report].[HasData], [Orders].[Report].[txtOrderValue], 0)
=IIf([Orders].[Report].[HasData], Nz([Orders].[Report].[txtOrderValue], 0), 0)
=iif([rptEmployEvaluationOperator subreport].[Report].[HasData],([rptEmployEvaluationOperator subreport].[Report].[OPTotal]+=iif([rptEmployEvaluationOperatorTrainer subreport].[Report].[HasData],[rptEmployEvaluationOperatorTrainer subreport].[Report].[OPTotal])/2
and the same idea for the second one. I tried both methods and did not work. I am not sure what I am missing.
View 10 Replies
View Related
May 2, 2013
I have a subreport with bitmap files attached, the sub works great until I link it to the main report then the sub shows nothing.
View 2 Replies
View Related
Mar 1, 2013
I have a subreport that works fine on its own. But, when I link to the main report I have an error, which I am attaching here.
View 1 Replies
View Related
Aug 8, 2014
I have a database (Access 2007) that handles a large number of consultants. Each consultant has a number of skills, has worked in a number of countries, and speak several languages. As contracts come in, I wish to generate a report based on the skill set, language and country/countries that best suits the contract; thereby identifying a group of most suitable consultants. I have designed a report with three sub reports for skills, languages and countries. Each sub report is linked to the main report through Link Master/Child fields using the ConsultantID. That's all fine; I get a report showing all consultants listing all their qualities.
Now, I want to be able to filter the sub reports on the three aspects: Skills; Countries; and Languages.
In the past, for other applications, and with the unfiltered form in preview I have used a popup form with unbound Combo Boxes to generate a string to use in the reports filter. I think I got that technique from Allen Browne, and it has really served me well.
Now, however, I can't use this technique since I can't set the filter for the sub reports. I thought that I might be able to use the Link Master Field with text boxes on the main report, but haven't managed to figure that out.
View 14 Replies
View Related
Jul 16, 2015
I have a main form with a subreport.
Mainform width is 22"(Maximum)
Subreport Wdth is also 22" (Maximum)
When i run the mainform, the subreport shows correctly but the vertical scrollbar is at most right side of main form so i have to scroll main form horizontally first to access the vertical scroll bar of subreport.
To solve, changing subreport orientation to right-to-left shows vertical scroll bar at most left but still if i scroll horizontally on mainform, that scrollbar hides as its not freezed.
Consider ActiveX Control of Microsoft ScrollBars 2.0 .....
View 14 Replies
View Related
Feb 28, 2012
I am creating a booking database for a Bus Hire company. There is also an Invoice element to it, which will Invoice customers for a range of bookings that they've made.You will see in the screen image, the relationships between the four tables:
-tblInvoice
-tblInvoiceDetails
-tblCustomer
-tblBooking
IN tblBooking (see screen dump) the customer is allocated a booking number and so on. However, at the end of the month, the Customer will be invoiced for specific bookings. I would like to, firstly, select the customer in the Invoice form, then in the InvoiceDetails subform, select THE BOOKINGS THEY HAVE PREIVOUSLY Made using a look up. (see screen dump called frmInvoice.Gif)
I have applied a criteria to the data source for the look up. (see image datasource...GIF) with forms![frmInvoice]![CustomerID] in the hope that the query will search for BookingIDs where the currently selected CustomerID (in Form Invoice) finds a corresponding match in tblBooking.
View 14 Replies
View Related
Jan 22, 2014
Is it possible to use Filter option in my form without using Query Wizard? - So that the user would be able to edit and change the other field on the same form
View 2 Replies
View Related
May 6, 2013
I have faced with a problem while i was filtering my main form.....my problem is when i filter the main or parent form the related sub-form also gets filtered how to manage the main form so that when i filter it the sub-form should not be filtered so that i can get the related record to my filtered one in the sub-form... as for the time being when i filter the main form the related record in the sub-form is not shown and when i press unfiltered on the sub-form its data gets appeared....
View 11 Replies
View Related
Aug 26, 2004
I have a report that has an embedded subreport. The main report is grouped on client id. The aim is print a different client on a different page (I have the force new page after section set). The subreport is put into the section footer. The problem is that the subreport is based on a different query. How can I filter the subreport query result to show only the information for the client specified in the main report.
thanks
newbie
View 3 Replies
View Related
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
Apr 27, 2013
I have a Suppliers database which contains a form that will allow me to place orders with Suppliers.The Main form has a combo box that allows me to select the supplier. The combo box is called SupplierID with the following:
Row source: SELECT Suppliers.SupplierID, Suppliers.CompanyName FROM Suppliers ORDER BY Suppliers.CompanyName;
The subform is called Stock Subform witha combo box called ProductID with the following:
Row source: SELECT DISTINCT Products.ProductID, Products.ProductName, Suppliers.CompanyName, Products.Discontinued FROM Suppliers INNER JOIN Products ON Suppliers.SupplierID=Products.SupplierID WHERE (((Products.Discontinued)=0)) ORDER BY Products.ProductName;
Event Procedure - AfterUpdate: Private Sub ProductID_AfterUpdate()
On Error GoTo Err_ProductID_AfterUpdate
Dim strFilter As String
' Evaluate filter before it's passed to DLookup function.
strFilter = "ProductID = " & Me!ProductID
[code]..
The Link fields are done on the Purchase Order ID (PONoID).What I want to achieve is to select the supplier from the combo box (SupplierID) on the main form and then the combo box (ProductID) on the subform to filter to only show products directly supplied by the Supplier selected on the Main Form.
View 11 Replies
View Related
Jun 26, 2013
I have a report which programmatically sets the value of some labels based on its own internal logic for each line of the detail section of a report. This all works fine and dandy, using the Detail_format event, and accessing detail.controls.item(x).caption.
HOWEVER, when I then embed the report as a subreport (which I need to do), I goes wrong. Here, I get the values of the last row of the detail repeated in every previous one. I'm suspecting because the parent report has its own 'detail' (I've tried giving the subreport its own distinct detail name).
View 1 Replies
View Related
Jul 20, 2006
I am making a Customer Contacts database. The people in this database are organized into 30 groups.
I have one main form, and 30 queries to filter the records displayed on the form
I made buttons on a form representing the different groups of contacts to view, and when you click on one of those buttons, the main form opens with the record source as the query of the group you clicked on.
Here is my coding for one of the buttons
DoCmd.OpenForm "MainForm"
Forms![MainForm]![HomeAddress].Form.RecordSource = "Company Work"
Also on the main form, I have a button to open a report that displays address labels of all the people in the database
How do i code that button, so that the records displayed in that report will be the same as those records displayed on the form? How do i filter the records in the report so they will be the same as in the form?
View 1 Replies
View Related
Jul 9, 2014
I'm having a bit of trouble with a piece of VBA code I have. What it's supposed to do is filter and sort a report using a form. But there are two lines, which both I need, in it that are not compatible with each other. When both are in and I apply the filter with only a sort, it gives me a "Run-time error '5': Invalid procedure call or argument."
But the code runs beautifully when only one of the pieces, which I've highlighted in red below, is in it. The debugger highlights strFilter = Left$(strFilter, lngLen) after I have received the error.
Code:
lngLen = Len(strFilter) - 5
If (lngLen <= 0) And ([cboSort1] = "Not Sorted") Then
MsgBox "Insert criteria before filtering.", vbInformation, "No Criteria"
Else
strFilter = Left$(strFilter, lngLen)
[Code] ....
View 14 Replies
View Related
May 7, 2015
I have a form with 3 combo boxes that filter another form/report. The first combo (cboByCategory) contains options from 2 different fields within the same table. Before I added this add'l piece of code, all 3 combos worked fine. I am not getting error messages, it just does not filter on the other 2 combo boxes - cboDiv and cboGender.
Code:
Private Sub cmdModifyRecords_Click()
On Error GoTo Err_cmdModifyRecords_Click
Dim stDocName As String
Dim strFilter As String
Dim stLinkCriteria As String
stDocName = "Modify_OpenItems"
[Code] .....
View 5 Replies
View Related
Mar 12, 2015
I have a report with a table as the row source. I have command buttons that opens different forms and allows the user to choose criteria, the form then filters the report based on the chosen criteria in the form, but if I use the destination city form to filter the report by destination city, then filter the report using a different form, the destination city filter is lost, is there a way to filter the report with a form by say destination city, then further filter that dataset with another form for say location city.
View 14 Replies
View Related
May 19, 2015
I have a button on my main form that allows me to view one of my reports. In order to view the report I have to close my main form. My problem is how do I reopen my main form when I close the report that I have viewed? Some code that would reopen my main form when clicking on the X in the upper right hand corner of the report to close it?
View 13 Replies
View Related
Jun 15, 2005
I have a Report linked with a SubReport. I would like to cancel viewing this Report if my SubReport Has No Data.
i tried this code but the report just shows up. Any Ideas?
Private Sub Report_Open(Cancel As Integer)
On Error GoTo Err_Trapper
If Reports![qryRepCurOrgProjsSR].Report.HasData = 0 Then
Cancel = True
End If
Err_Trapper:
MsgBox Err.Description
Exit Sub
End Sub
Ok i got an error message. Yoy entered an expression that has an invalid Reference to the hasData property.
Ive tried using a text bpx on my main report and putting a control source as
=IIf(qryRepCurOrgProjsSR.Report.HasData,0,"Nothing")
Then in my Report Open Event i put the code below. But it fails me still.
If trim(Me.MyText) = "Nothing" Then
MsgBox "The Report Is Cancelling....."
Cancel = True
Exit Sub
End If
View 3 Replies
View Related
Jan 12, 2015
I'm trying to create a report that contains data from a "main" form and a subform. However, I can't get the main form data to populate no matter what I try. I've been through all sorts of queries and just can't get it to work. The main form and subform are both separate tables, and there are no redundant fields.
Basically, the main form is an inventory of assets, and the subform is designed as a way to submit trouble tickets when one of those assets requires maintenance or repair.
View 3 Replies
View Related
Mar 5, 2006
I have a report named rpt100 with two subreports srpt100a and srpt100b. The subreports are based on query qry100a and qry100b. Both queries are based on tbl100. I removed a field named 'Comment' from tbl100, as it wasn't useful; Also removed the fieldname from both qry100a and qry100b. When opening rpt100 a parameter dialog opens asking for data on the deleted fieldname 'Comment'. The field 'Comment' was never used in the report or subreports.
Inspection of the subreport fieldlist shows field 'Comment' still present.
How, other than remaking the rpt100 and both srpt100a and srpt100b, do I remove the field 'Comment'?
Gunner...:confused:
View 1 Replies
View Related
Jun 25, 2014
linking a report and a subreport (chart). I have uploaded my sample DB. I'm trying to chart all the individuals and three fields for each Home. Both report and subreport are using the same query for the record source. My charts are blank "All_Homes_Individual_Totals". Just use date range 05/01/14, 06/24/14 on my Main form page for the data.
My second question is how would you create a chart to pull by each individual with their monthly totals per Home using "qry_Community_ Inclusion_ All_Homes" with a report and subreport (chart) as above. Report would show the individual's totals by month for each home.
View 1 Replies
View Related
Aug 26, 2012
I have a report with a subreport on it and I find that the subreport has alot of space between each of the rows of data that are shown.
How can I change the space between rows so it is not so great?
I tried "Padding" but this seems to change the distance between fields on each row, but not the distance between the rows.
View 2 Replies
View Related
Nov 9, 2011
I have a report that is fixed at one page for one record. However, there is a subreport with many transactions ("CanGrow"=No). If this goes to a new page I have to close the report and start a new one. This all works fine, except for the last transaction - if the second-to-last transaction record is at the bottom of a page then the last one does not print.
Access seems to format the data, then it realizes that it won't fit on the page so doesn't print it. I am using record id number to know which transaction record to start the next report on, so when it gets to the end my logic thinks it has reached the end as the id number is the last one in the set.
How can I know if the last record has printed or not?
View 2 Replies
View Related