Print a Variable

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
 
S

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
 
D

Duane Hookom

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top