Nested reports not filtering correctly

S

sakuragirl1

I have a 8 reports that have various subreports on them and this set up
works fine. I now have decided I need for it to be output as 1 report,
so have created a single main report and placed the 8 reports as
subreports onto this. Now unfortunately my filter is no longer working
and i cannot figure out why. Everything is all joined by a single
primary key 'requestid', but all the data for all the requestid's is
appearing on the main report now.

NESTING:
(main)Allreport
(sub) ScoringRequest1(linked master/child on requestid)
(sub-sub)TimeFrames (linked master/child on requestid)
(sub-sub)DataSource (linked master/child on requestid)
(sub) ScoringRequest2 (linked master/child on requestid)
(sub-sub)DataIntegrity (linked master/child on requestid)
Etc....

FILTERING:
cfilter = applyfilter3("scoringrequest")
DoCmd.OpenReport "allreport", acViewPreview, cfilter,
acWindowNormal

Function applyfilter3(tablename) As String

On Error GoTo Err_applyfilter3

Dim con2 As Object
Dim rs2 As Object
Set con2 = Application.CurrentProject.Connection
stsql2 = "SELECT * FROM [" & tablename & "] WHERE [" & tablename &
"].requestid=" & ScoringRequestID & ";"
Set rs2 = CreateObject("ADODB.Recordset")
rs2.Open stsql2, con2, adOpenForwardOnly, adLockReadOnly

applyfilter3 = stsql2

' Close the recordset and the database.
rs2.Close
Set rs2 = Nothing
Set con2 = Nothing

Exit_applyfilter3:
Exit Function

Err_applyfilter3:
MsgBox Err.Description
Resume Exit_applyfilter3
End Function
 
Top