A
apollo8359
The following solution was given by Allen Browne for a question about how to
display public variables in a report, however, I don't know where to put this
code. In my database all the reporting code is in a "Main Module", in a
procedure called Reports, there is no code behind the form, which is
completely unbound. The variable I want to display [ReportDate] is already
public as a string, but the report won't recognize it as he states below. The
string [ReportDate] is a concatenation of the startdate and stopdate so the
report will display "1/1/2006 through 3/31/2006", if that helps. Anyway,
could anyone advise me on where to put this code, thanks
You cannot read the data from variables directly into a text box. The
workaround is to create a function to return the value of the variable,
e.g.:
Public MyVar As Variant
Public Function GetMyVar() As Variant
GetMyVar = MyVar
End Function
You can then set the Control Source of your text box to:
=GetMyVar()
display public variables in a report, however, I don't know where to put this
code. In my database all the reporting code is in a "Main Module", in a
procedure called Reports, there is no code behind the form, which is
completely unbound. The variable I want to display [ReportDate] is already
public as a string, but the report won't recognize it as he states below. The
string [ReportDate] is a concatenation of the startdate and stopdate so the
report will display "1/1/2006 through 3/31/2006", if that helps. Anyway,
could anyone advise me on where to put this code, thanks
You cannot read the data from variables directly into a text box. The
workaround is to create a function to return the value of the variable,
e.g.:
Public MyVar As Variant
Public Function GetMyVar() As Variant
GetMyVar = MyVar
End Function
You can then set the Control Source of your text box to:
=GetMyVar()