Source code? Do you mean the (sub)report's RecordSource?
If so, it can be done in the (sub)report's Open event. For
subreports this can only be done the first time the
subreport's Open event is called.
Yes sorry source code. But how do I change the subreports
source code from the main report? What I mean is how do i
use the OnOpen event for a subreport?
Ive tried adding it just to the OnOpen section on the
report but when its opened from another report it comes
up with the error that it cant be changed when printing
has started.
So i was wondering if there was a way of doing it from
the main report such as Reports!Subreport.recordsource
= ? This however comes up with an error aswell saying I
cant assign a value.
Yes sorry source code. But how do I change the subreports
source code from the main report? What I mean is how do i
use the OnOpen event for a subreport?
Ive tried adding it just to the OnOpen section on the
report but when its opened from another report it comes
up with the error that it cant be changed when printing
has started.
So i was wondering if there was a way of doing it from
the main report such as Reports!Subreport.recordsource
= ? This however comes up with an error aswell saying I
cant assign a value.
If that would work, the syntax would be:
Subreport.REPORT.recordsource = "whatever"
but, as you've seen, the main report and subreport are
opened in sequence and the subreport is not ready at that
point. You can use a (sub)report's Open event only to set
its own record source.
To guard against trying to do it more than once in the
subreport's Open event, you can set it conditionally:
Static Initialized As Boolean
If Not Initialized Then
Me.RecordSource = "whatever"
Initialized = True
End If
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.