Set a permanent variable at database startup???

  • Thread starter Thread starter Jason Gyetko
  • Start date Start date
J

Jason Gyetko

I was wondering if there is anyway you can set a variable when the startup
form is initially opened that can be used from every other form opened
thereafter? I want to read a value from a table and set my variable equal
to that, from then on that variable will not change until the database is
closed and re-opened. I'm trying to avoid reading that value from the table
every time I open up a different form, I just simply want to specify the
variable name and that's it. Can this be done, if so can you point me in
the right direction. Thanks.
 
In a module (name it "Globals"), create a public variable, such as:

Public gstrMyVariable as String

g = visual indicator that this variable is a GLOBAL variable
str = this variable will hold a STRING value
int = this variable will hold an INTERGER value
lng = this variable will hold a LONG value
:
:

HTH

--
Rob

FMS Professional Solutions Group
http://www.fmsinc.com/consulting

Software Tools for .NET, SQL Server, Visual Basic & Access
http://www.fmsinc.com

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 
Just as long as you realise that an unhandled error will clear your global
variables. An alternative approach is to read the variable from the table
onto a hidden form at startup. Then refer to the form when you want the
value.

--
Regards,

Adrian Jansen
J & K MicroSystems
Microcomputer solutions for industrial control
 
Back
Top