changing recordsource of subreport

N

ngan

I think I asked this in the past, but I don't recall the answer.

To make sure the subform looks at records for the specific ClientID on the
main form, I'm using the function in the Form_Open event procedure:
Static Initialized As Boolean
If Not Initialized Then
Me.RecordSource = "SELECT ..."
Initialized = True
End If

I can apply this to subreports too. And this applies only if the subreport
is used by one main report.

However, what if I have two reports that share the same subreport (same
fields)? And each main report will need the subreport to have a different
WHERE criteria. Is it best to just have two different subreports, or can I
code it so the subreport runs the correct WHERE criteria, depending on what
main report is opened?
 
Top