VBA
(1)
GetCurClient
(1)
Report
(1)
CurrentClient
(1)

Print a Variable

Asked By Stefan
20-Nov-09 03:36 PM
I have a routine programmed in the a footer section of my report.

I have a variable

Dim CurrentClient as string

CurrentClient = "[Client]"

I would like to be able to print the variable currentClient in the footer on
the report.

I tried in the control source =[CurrentClient]

Does not work

Any help would be appreciated

Stefan

You will probably need a simple public function that returns the variable

Duane Hookom replied to Stefan
20-Nov-09 04:26 PM
You will probably need a simple public function that returns the variable like:

Public Function GetCurClient() as String
GetCurClient= CurrentClient
End Function

You can then set a control source to the function.
--
Duane Hookom
Microsoft Access MVP

Does that go in the Module I have written or does that go in a seperate module?

Stefan replied to Duane Hookom
20-Nov-09 04:39 PM
Does that go in the Module I have written or does that go in a seperate module?

Or is that just replacing the DIM function for the variable?

sorry if the terminology is off I am new at VBA

The variable you want to print should be a public variable.

Duane Hookom replied to Stefan
21-Nov-09 12:28 AM
The variable you want to print should be a public variable. The function
should reside in a standard module.

You might want to read some articles on memory variable scope if you cannot
figure this out.

--
Duane Hookom
Microsoft Access MVP
Post Question To EggHeadCafe