Z
zakhan
Hello,
I have read a lot of previous emails that relate to this issue but
still can't figure out how to do this (which should be possible because
it seems like such a common usecase):
I am opening a Report using VBA from my Visual Basic application using
the DoCmd.OpenReport function. Basically the user builds the
'whereCondition' graphically in the VB app and this is passed onto the
Report in the whereCondition.
Now on the Report there is a TextBox which should be populated with one
of the parameter values in the whereCondition (I get this value after
some nasty splitting). However, I am unable to get the Filter value in
the Report_Open event method (as I have read from some previous posts,
this is a Microsoft 'feature').
So the next logical thing for me to do was to put it in the
PageHeaderSection_Format method but even though we have the Filter
value, it is too late to set the TextBox ControlSource by that time!
Basically this doesn't work:
Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As
Integer)
fltr = Me.Report.Filter
tokens = Split(fltr, "#")
monthYearDt = tokens(1)
Me.MonthYearVal.ControlSource = "=#" + monthYearDt + "#"
End Sub
It gives me the following error:
"You can't set the ControlSource property in Print Preview or after
printing has started..."
Can someone please point me in the right direction?
Thank you.
I have read a lot of previous emails that relate to this issue but
still can't figure out how to do this (which should be possible because
it seems like such a common usecase):
I am opening a Report using VBA from my Visual Basic application using
the DoCmd.OpenReport function. Basically the user builds the
'whereCondition' graphically in the VB app and this is passed onto the
Report in the whereCondition.
Now on the Report there is a TextBox which should be populated with one
of the parameter values in the whereCondition (I get this value after
some nasty splitting). However, I am unable to get the Filter value in
the Report_Open event method (as I have read from some previous posts,
this is a Microsoft 'feature').
So the next logical thing for me to do was to put it in the
PageHeaderSection_Format method but even though we have the Filter
value, it is too late to set the TextBox ControlSource by that time!
Basically this doesn't work:
Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As
Integer)
fltr = Me.Report.Filter
tokens = Split(fltr, "#")
monthYearDt = tokens(1)
Me.MonthYearVal.ControlSource = "=#" + monthYearDt + "#"
End Sub
It gives me the following error:
"You can't set the ControlSource property in Print Preview or after
printing has started..."
Can someone please point me in the right direction?
Thank you.