Full Version: How to call the public variable value in Report
UtterAccess Discussion Forums > Microsoft® Access > Access Reports
Murali
Dear All,

I would like to use the value of a variable defined in the module in a report. I created a text box and assigned the control source property to "=[sCurrency]" where sCurrency is the variable defined in the module. This is not recognized and asking for the parameter value for "sCurrency" while running the report, but when I use the same variable in forms it shows the value stored in the variable "sCurrency".

This is very much required as I need to print the currency type in the reports using the public variable.

Could any one give any suggestion for this ?

Thanks in advance.

Bye,

Murali
bome
You must write a function that will return the value. Something like this

Public Function GetCurrency() As String
GetCurrency = sCurrency
End Function

Then use the function name in the control source property

=GetCurrency
________
Bo Melin
cheekybuddha
Hi Murali,

Use a function to return the value of your global variable:

CODE
Public Function fCurrency() As String

    fCurrency = sCurrency

End Function


Make the function return the same datatype as sCurrency (I'm guessing it's a string since it's called 's'Currency)

hth,

d
Murali
Dear Bo Melin & CheekyBuddha,

Thank you so much, it works. I really appreciate the great support provided by both of you.

Regards,

Murali
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.