user-controllable constants

DataMiner

Registered User.
Local time
Today, 16:01
Joined
Jul 26, 2001
Messages
336
Hi,
What's the best way to set things up so that users can change the value of a constant? I currently have stuff in my code like

Public Const T4ChGoal As Double = 9

but that means that whenever my users decide to change their goal, they have to call me, I have to edit the code, and re-distribute new copies of the front-end. Obviously not very desirable.

In other places I have put similar information in a table, something like:
Fieldname=T4ChGoal
FieldValue=9
Then I use a Dlookup in the code wherever I need to use this value, and I supply the user with a form to edit the values in the table when necessary. However, I know Dlookups can be slow so am not sure this is the best way to go.

I was really hoping I could do something like
public const t4ChGoal as double=dlookup("FldValue","Constants","FldName='t4ChGoal'")
but of course Access won't let me do this.

Is there a better way?
 
DataMiner,

There's nothing wrong with a little "job security".

Seriously, you can use a table to store the values.

Declare your old constants as Public Variables.

Your startup form can call a function in a Public module
to set their initial values.

Wayne
 
Perfect! Thanks so much!
 

Users who are viewing this thread

Back
Top Bottom