Need a flag in a database (1 Viewer)

Wulf13

Registered User.
Local time
Today, 00:07
Joined
Jul 6, 2004
Messages
85
I need a flag(indicator) for my database. This flag would be read by many different functions and depending on the value of the flag, would do one of two things.

Example: If the flag is "A", when I click a button in a form it does "C" function. If the flag is "B", then in case of the previous button it will do "D" function.

What I'm having a hard time with is where to store said flag. Mind you the flag is either one or the other ("A" or "B") for the entire database, not just a specific record(s). I thought about adding a field to my 'master' table and then use an update query to change all the values from "A" to "B" as needed, but that seemed a bit like storing redundant data.

How or where should I store this flag?
 

Luddite Lad

Registered User.
Local time
Today, 16:07
Joined
Aug 23, 2005
Messages
177
If the flag is effective across all data within the database, then why not just store it in it's own table, which you can then update as needs be?
 

Wulf13

Registered User.
Local time
Today, 00:07
Joined
Jul 6, 2004
Messages
85
So use a table to store a single value and then use an update query or some other way to change the value as needed???? mmm.....that sounds like a good idea. I'll have to think about that. Thanks.
 

Wulf13

Registered User.
Local time
Today, 00:07
Joined
Jul 6, 2004
Messages
85
ghudson...what is this global string you speak of?
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 01:07
Joined
Feb 28, 2001
Messages
27,254
ghudson, global strings are stored in the workspace, which makes them global across all apps, forms, reports, modules, macros - but still private to the user. I read his request as being - global across all users.

Wulf13, the only way to do the latter interpretation is a small table used for just such global linkages as this. If you are familiar with the Windows Registry then you would recognize that two fields are all you need: Key and Value. Then store your "global key names" in the Key field and the values for each in the corresponding value field. Then a DLookup does the trick to look them up. And if you need to update a value, a simple SQL statement can do the job.

One word of warning: You MUST consider the implications of login order and update of a key when you design your app. If I log in first and you log in second, I will see one value of the key and you can change it later, but I won't see it that way UNLESS the app is coded to re-test frequently.
 

Wulf13

Registered User.
Local time
Today, 00:07
Joined
Jul 6, 2004
Messages
85
Thanks Doc Man, I have an idea of what your talking about but its still pretty far above my head. I think I will stick with using a single table to store said flag and use a dlookup to reference it. This seems easier for my access understanding.
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 07:07
Joined
Sep 12, 2006
Messages
15,667
if you store the flag in a table, it will retain its setting from session to session. if you store it in a global variable, it will start each session in the same state. if you store it in a table and the data is shared you may find that one user causes the behaviour to change for others. is that ok.

you could also save it in the registry. access provides a simple way of saving and retrieving settings such as this directly from the registry
 

Wulf13

Registered User.
Local time
Today, 00:07
Joined
Jul 6, 2004
Messages
85
Gemma,

I'm not sure how to store it globally or in the registry. I understand the risk I take storing it in a table, however I've put a password on the function that changes the flag so only one or two people should be able to change the flag. This should prevent the casual user from inadvertantly changing the flag.
 

Users who are viewing this thread

Top Bottom