application constants : where ?

inoxo

Registered User.
Local time
Today, 07:01
Joined
Sep 8, 2005
Messages
42
Hi,

I would like to put all my constants at the same place in my application.

I put them before the first procedure of the first form which opens when I start my application, with "public" before.

ex. public const ModelPath as string = "\xxx\"

But VBA doesn't allow that (error message ...) and I don't see what's wrong.

Thanks for your help.
 
Public variables need to go into a public module, not a form level module. Create a new public VBA module and put your declarations in it.
 
Thanks DJkarl.
But how do I create a new public VBA module ?
Should I create a "Public sub" ... with only "Const" ... sentences ?
I don't see how the code sould be.
 
On the Modules tab of the database window click New, name the module whatever you'd like, and inside the module make your declarations of Public Const mName = "\xxx\", you just cannot declare public constants in a form module.
 
You're right.
Yhanks for your help DJkarl.
 
If you want your constants to be dynamic, store them in your Param table and fill your global variables from this table when you start your database. Expecially paths and version numbers are stored there.

The Param table is in all my databases
Mnemonic (Text50)
Value(Text255)
Type(Text15)
Description(Text20)

HTH:D
 

Users who are viewing this thread

Back
Top Bottom