[AccessD] How to do an Admin Table

John W. Colby jwcolby at colbyconsulting.com
Fri Feb 6 14:09:54 CST 2004


John,

For a demo see www.colbyconsulting.com .

I use what I call a SysVar table.  However I would suggest using a record
for every variable rather than a single record with a field for each
variable.  The structure I use is:

SV_ID		- Autonumber PK - never really used but...
SV_VarName	- The name of the system variable - Company Name, Developer Name,
whatever.
SV_VarValue	- The value of that SysVar
SV_Memo	- A text description of the variable, default values etc.

There are many reasons for going this way, SysVars can be added and deleted
at will, it is trivial to update values programmatically if needed etc.

I have a class that I use for this.  The class is fed a table name, and it
opens the table and reads the SysVars into a collection, with the collection
value  the VarValue and the Collection key the VarName.  The class then has
a function that allows you to pass in a VarName and get back the VarValue.

I use these EVERYWHERE.  It is a very handy concept once you get the hang of
it.  As you know, I do a framework.  I use a SysVar table right in my
Framework Library that sets up default functionality for the framework.
Things like:

VarName gJITSFrms, VarValue True

Sets up the framework to default to using JIT subforms.

In my code I then do something like:

	If FWSysVar.VarVal(gJITSFrms) = true then
		'Run the code that allows a JIT Subform
	else
		'Run the code that turns off JIT Subforms
	endif

IOW I can actually control program flow based on SysVars, turn on and off or
otherwise modify behaviors of the program.

I can then put an identical SysVar table (same name) in my FE and OVERRIDE
the default values.  The class has a "Merge" property that reads values out
of a second table and "merges" it into the collection.  If the value being
read from the table is not already in the collection it is simply added in.
If the value being read from the table is already in the collection, it is
updated to the value being brought in.

This allows me to do things like "for THIS FE set the default JIT behavior
to false", i.e. don't use JIT as the default behavior.  In fact I have
developed a method of doing "overrides" on a form by form basis.  That is a
little beyond the scope of this email however.

I can then build a APPSysVars table where I place application specific
sysvars.  This can be SysVars that modify APPLICATION BEHAVIORS based on the
values in this SysVar table.

Another SysVar table can be used for Application specific DATA such as
Company Name, Company Tax ID etc.

As you can see, SysVars are just a wonderful place to throw these things and
doing it on a record basis rather than a "new field in a single record"
basis allows me to just hop over to the SysVar table ad add a new SysVar
record when I need to do some new thing.

As I mentioned, I have a working demo up on my site.  Click the C2DbSysVars
button.

John W. Colby
www.ColbyConsulting.com

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of John Clark
Sent: Friday, February 06, 2004 2:25 PM
To: accessd at databaseadvisors.com
Subject: [AccessD] How to do an Admin Table


Forgive me, if this is an easy one, but I've even asked someone that
teaches the Microsoft Access certification classes, and they didn't know
how to do this either--or maybe I wasn't clear, when I asked.

I have had many programs where it would be useful to have an "admin"
table. This table would contain one single record with information
referenced in other parts of the program. For instance, I have a program
that figures monthly mileage for our county legislators, but it is
currently setup so that the rates are hard-coded and I have to alter
them everytime they are changed. I would like the user to alter this
themselves.

I have also thought about using this for programs--maybe in their
splash screens--to list the current directors names, and other info that
may or may not change in the future.

Any ideas how?

Thanks ahead of time...because I know if it can be done, somebody on
this list knows how to do it!!!

John W Clark

John W. Clark
Computer Programmer
Niagara County
Central Data Processing
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com





More information about the AccessD mailing list