public value in report

J

Jean-Paul

Hi,
I have a module where I declare some public values.
I called it MP_Setup
Here I have some date variables: Start_datum

When I create a report and I want that value in the header I created an
entryfield and wrote in the property:

= MP_Setup.start_datum

Acces automatically changes this into

= [MP_Setup].[start_datum]

Which of course returns an error...

What am I doing wrong?
Thanks
 
A

Allen Browne

You cannot read a variable directly.

Use a function to return the value:
Public Function ShowStartDatum()
ShowShartDatum = Start_datum
End Function
and set the Control Source to use the function:
=ShowStartDatum()

Either that, or assign it to something other than a variable, e.g. a
(hidden) text box on a form, or a TempVar (Access 2007 only.)
 
A

Allen Browne

If you might need it available for other forms/reports as well, it would be
best in a standard module (one created through the Modules tab of the
Database window, or the Insert menu in the code window.)
 

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