setting recordsource

  • Thread starter Thread starter Rick
  • Start date Start date
R

Rick

The newsgroups I need are no longer available, anyone know
why? I need to set the recordsource of a subreport from my
code. I create a string of the SQL but when would I apply
it, how and how do I refer to the subreport?

Thanks.

Rick
 
Rick said:
The newsgroups I need are no longer available, anyone know
why? I need to set the recordsource of a subreport from my
code. I create a string of the SQL but when would I apply
it, how and how do I refer to the subreport?


The only place where you can set a (sub)report's record
source is in its own Open event. Not only taht, but you can
only set it once. This is not an issue in a main report,
but a subreport's open event will be triggered each tme the
subreport appeares. In order to make sure you don't try to
set it after the first instance, you can use code like this
in the subreport's Open event procedure:

Static Initialized As Boolean
If Not Initialized Then
Me.RecordSource = "Select . . . "
Initialized = True
End If
 
Back
Top