Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

defining a Global variable

0 views
Skip to first unread message

Chris Stevens

unread,
Jan 28, 2001, 5:53:41 AM1/28/01
to
Is it possible to define a global variable which can be used in
queries/forms/reports and easily reset in the future?

I have to vave reports which are headed "2001/2002" which I need next year
to say "2002/2003" and do not want to change each report manually.

There would be other global variables like Year etc. and date ranges that I
would like to set.

Any help or guidance in the right direction would be very much appriated.

Nathan

unread,
Jan 28, 2001, 6:31:43 AM1/28/01
to
Chris an easy way of doing this would be to read the value from a registry
key, you should be able to use the standard registry API's to do this.

HTH

Nathan

John W. Vinson

unread,
Jan 28, 2001, 3:35:26 PM1/28/01
to

"Chris Stevens" <ch...@actraining.co.uk> wrote in message
news:eNTH#hRiAHA.1620@tkmsftngp02...

> Is it possible to define a global variable which can be used in
> queries/forms/reports and easily reset in the future?

A couple of suggestions: though you can do this with a global variable, it's
a bit of a pain in the neck to use it; you must write a small VBA function
that just returns the value of the variable. It's often simpler to have a
small (minimized or invisible) unbound startup Form with controls containing
the values you want to use.

If it's a year, why not just pick it up from the Date() function? E.g. this
year you could use

Year(Date) & "/" & Year(Date)+1

You can also use the DateSerial function for criteria.

John W. Vinson


0 new messages