Global Variables dropping

  • Thread starter Thread starter Richard
  • Start date Start date
R

Richard

I am using a global variable and the idea was to use them to store
data read from a table for the duration of an access session. I
understand this is not the best way to do this because for instance if
Access encounters an unhandled error, the global variables reset
themselves.

However, I have an EXTREMELY slow server -even opening the table takes
15-20 seconds (and the table is only 10 records and 7 fields). So I
am loathe to keep accessing the tables from the server. I should add
that I am not using SQL Server, and both the front end and back end is
held on the server although the front end is held on each user's
private section of the server. The C: drive gets completely wiped
each night I understand.

Can anyone recommend a way to store these variables. They are
variables that just store each user's ID, Department ID etc.

Richard

Its a good job Einstein never had to fill out one of these Government Grant applications or we never would have found out what e equalled. The West Wing
 
Richard said:
I am using a global variable and the idea was to use them to store
data read from a table for the duration of an access session. I
understand this is not the best way to do this because for instance if
Access encounters an unhandled error, the global variables reset
themselves.

However, I have an EXTREMELY slow server -even opening the table takes
15-20 seconds (and the table is only 10 records and 7 fields). So I
am loathe to keep accessing the tables from the server. I should add
that I am not using SQL Server, and both the front end and back end is
held on the server although the front end is held on each user's
private section of the server. The C: drive gets completely wiped
each night I understand.

Can anyone recommend a way to store these variables. They are
variables that just store each user's ID, Department ID etc.

You realize that storing the front-ends on the server eliminates many of
the benefits of a split database? You may also want to take a look a
Tony Toews' Access Performance FAQ,

http://www.granite.ab.ca/access/performancefaq.htm

to see if there's anything there that could speed your access to the
server.

In the mean time, one handy way to manage global variables is to set
them up as properties in a standard module, with Property Get procedures
that check to see if the private variables that hold the actual values
need to be reloaded. It can look like this:

'----- start of example module code -----
Option Compare Database
Option Explicit

Private mvarMyProperty As Variant

Public Property Get MyProperty() As String

If IsEmpty(mvarMyProperty) Then
mvarMyProperty = DLookup( ... )
End If

MyProperty = mvarMyProperty

End Property
'----- end of example module code -----

Then your code elsewhere can say

blah = MyProperty

and the value will be loaded from the table only if it hasn't already
been loaded, or if its value has been lost because the project was
reset.
 
and both the front end and back end is
held on the server although the front end is held on each user's
private section of the server.

Not v good idea: better to run the Front End on the local HDD.
The C: drive gets completely wiped
each night I understand.

Can you use a script to copy the server version to the local disk and run
it from there? The server response is slow probably because of all the
unneccesary network traffic! And if that is the case, you are begging for
a database corruption along the way... :-(

To answer the original question, you can preserve variables in the
Database properties. My favourite place is

db.Containers("Databases").Documents("UserDefined").Properies

because they can be read/ debugged/ altered from the GUI when testing and
setting up. Check out the CreateProperty method and its friends and
relations first.



Hope that helps


Tim F
 
Back
Top