473,467 Members | 2,111 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Filter SubReport on load

Brilstern
208 New Member
Ok,

My goal is to filter two SubReports within a master report. I have the Master report that is opened by the below:
Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdOpenECR_Click()
  2.  
  3.     Dim strFilter As String
  4.     strFilter = "[SSN] = '" & Me.MemberSelect & "'"
  5.         Call DoCmd.OpenReport(ReportName:="rptECR", View:=Access.AcView.acViewReport, wherecondition:=strFilter)
  6.  
  7. End Sub
With the below controls
Expand|Select|Wrap|Line Numbers
  1. =[rank] & " " & [lname] & ", " & [fname] & " " & [mi] & "."
  2. ="XXX-XX-" & Right([ssn],4) & "/" & [MOS]
  3. =[EAS] & "    Section: " & [Instrument]
  4. Date Checked In
  5. SSN (not visible, used for filter)
data sourced from the below table
tblBAnd Members
Expand|Select|Wrap|Line Numbers
  1. Field                      Type
  2. Rank                       Text
  3. FName                      Text
  4. LName                      Text
  5. MI                         Text
  6. SSN                        Text PK
  7. MOS                        Text
  8. EAS                        Date/Time
  9. Instrument                 Text
  10. Date Checked In            Date/Time
  11. Supply Rep                 Text
below are the data sources for the two subreports
tblInstruments
Expand|Select|Wrap|Line Numbers
  1. Field                      Type
  2. Category                   Text
  3. Instrument                 Text
  4. Make                       Text
  5. Model                      Text
  6. Serial                     Text PK
  7. Condition                  Text
  8. Location                   Text
  9. Checked In/Out             Text
  10. Date Checked Out/In        Date/Time
  11. Supply Rep Doing Check Out Text
  12. Purchase Year              Date/Time
tblNon Serialized Gear
Expand|Select|Wrap|Line Numbers
  1. Field                      Type
  2. Category                   Text
  3. Item Name                  Text
  4. Brand                      Text
  5. Condition                  Text
  6. Checked Out                Text
  7. Location                   Text
  8. Date Checked Out           Date/Time
  9. Supply Rep Doing Check Out Text
  10. Description                Text
The location on both subreport source tables is a Table/Query List expression built from tblBand Members. (=[rank] & " " & [lname] & ", " & [fname] & " " & [mi] & ".")

How do I filter both subreports on open to match the person that the master report is open upped to?
Jan 27 '12 #1

✓ answered by NeoPa

You need to determine which fields in [tblBand Members] match, and identify, which fields in [tblInstruments] and [tblNon Serialized Gear] (Separate sets for each of course). When you have this information then you go to each of the Subform/Subreport controls defined on the main report and specify the appropriate sets of fields for each side of the link using the LinkMasterFields and LinkChildFields properties.

This ensures that only matching records are ever populated and displayed in the subreports.

PS. Nicely formulated question. If only more members took that much care to prepare their questions properly we could get so much more quickly to the actual answers.

5 6144
Seth Schrock
2,965 Recognized Expert Specialist
You could base the subreports on a query that has the criteria of MemberSelect.
Jan 27 '12 #2
NeoPa
32,556 Recognized Expert Moderator MVP
You need to determine which fields in [tblBand Members] match, and identify, which fields in [tblInstruments] and [tblNon Serialized Gear] (Separate sets for each of course). When you have this information then you go to each of the Subform/Subreport controls defined on the main report and specify the appropriate sets of fields for each side of the link using the LinkMasterFields and LinkChildFields properties.

This ensures that only matching records are ever populated and displayed in the subreports.

PS. Nicely formulated question. If only more members took that much care to prepare their questions properly we could get so much more quickly to the actual answers.
Jan 27 '12 #3
Brilstern
208 New Member
NeoPa,

Took me a little playing around. I ended up creating a new query with the location expression in it. That way it had a reference from the SSN to the location. Linked the fields and wala! I appreciate it always!! Spot on Sir.

Sgt B
Jan 28 '12 #4
NeoPa
32,556 Recognized Expert Moderator MVP
Always a pleasure - especially working with a properly prepared question though :-)

Maybe if I repeat this some more then other members may pick up on it somewhat ;-)
Jan 28 '12 #5
Brilstern
208 New Member
Too Funny,

I have another question that follows into this one but I create a new question and link this one. Don't want to highjack my own question...

Sgt B
Jan 28 '12 #6

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

Similar topics

0
by: Bob Quintal | last post by:
Hi all, Using Access 97 Front End, linked to SQL Server back end. Required data is spread across three tables, with one table linked one to many to the two others. I created a report based on...
2
by: Deano | last post by:
OK, I've been taking the detour from hell trying to sort this and after taking a walk I think I need a rethink. I have a report for a single employee that includes a subreport which lists...
1
by: dd_bdlm | last post by:
This seems like a very silly simple question and I am sure I am doing something very easy wrong.....but.....I cant get my subreport to display on my main report! I have tried everything I can think...
1
by: shaqattack1992-newsgroups | last post by:
I know this is kind of a weird question, but is there anyway to give a subreport control of a main report? I posted my situation earlier about having drawings print out after a group. I have a...
8
by: | last post by:
hi, i have a form on which a user can choose specific criteria such as dates etc, in order to filter the report that is called from the form. i do this by using the Where section of the...
0
by: MLH | last post by:
I have a main report with a subreport on it. Main name: rptInvoiceMain Sub name: rptInvoiceSubReport The main report is unbound. A fiew calculated controls are all it has. The subreport is...
0
by: C | last post by:
Hi, I have a main Report which has a SubReport. This SubReport also has a SubReport. I set the data of my main Report and Subreport through code DataSet dsMainReport =...
17
by: =?Utf-8?B?SGVyYg==?= | last post by:
I have created a report and subreport in VB/ASP.NET. The report works fine but the subreport will not display. The subreport, when displayed as a standalone report, works fine. Any help I can...
94
by: mlcampeau | last post by:
I have a report (JobVacanciesOnly) that has a subreport (JobVacanciesOnlySR) that are based on two separate queries. MY - JobVacancyJobs SELECT Job.Code, Job.Title, Job.Grade, Grade.Minimum,...
11
by: Simon | last post by:
Dear reader, The syntax for the VBA code to change the RowSource of a Master Report is: Me.RowSource = "TableOrQueryName"
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,...
1
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...
1
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...
0
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...

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.