Print a Variable

  • Thread starter Thread starter Stefan
  • Start date Start date
S

Stefan

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
 
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

Duane Hookom said:
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


Stefan said:
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
 
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 can't
figure this out.

--
Duane Hookom
Microsoft Access MVP


Stefan said:
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

Duane Hookom said:
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


Stefan said:
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
 
Back
Top