Can a report be limited based on the content of its subreport?

gellerche

Registered User.
Local time
Today, 17:29
Joined
Jun 19, 2001
Messages
73
I have an Access db that I'm using to hold data and make reports for a VB front end. I have a report that has several controls (eg. Type) that are bound to the database. If I want to limit the report's output to certain criteria (for example only give output for records with Type = what the user selected from a combo), I just do this:

SQL = "TypeNames = '" & Me.cboType & "' "

Dim AccessObj As New Access.Application
With AccessObj
.OpenCurrentDatabase gblDatabaseLocation, False
.DoCmd.Maximize
.Visible = True
.DoCmd.OpenReport "rptSoftwareInventory", acViewPreview, , SQL
End With

Here's my problem: I also want the user to be able to limit the report based on the content of a SUBreport that's on this report. (eg. One of my subreports contains a Table field that's bound to the database. I'd like the user to be able to select a Table, and have the report limited to records that match that table.)

I've tried this code for the SQL (rptSoftwareInventoryTable is my subreport):

SQL = "Reports![rptSoftwareInventory]![rptSoftwareInventoryTable].TableName = '" & Me.cboTables & "' "

, but it doesn't work. Is it possible to limit the results of report through data that's bound in its subreport?

Thank you,

Steve Geller
 

Users who are viewing this thread

Back
Top Bottom