how to store temporary values

  • Thread starter Thread starter jokobe
  • Start date Start date
J

jokobe

hi ng,

within my database I have to stores often temporary
values, but I don't know for sure the best way to do this,
therefore I'm using two or three different ways:
- store the value in a hidden field in the actual form
- store the value in a global variable (for example:
the user name).
- store the value in a table, and delete the value when
closing the database (makes live very slow)
can't anyone point his finger on the best way or even
tell me a better way?

thanks and a nice weekend to all in this helpfull newsgroup

joachim
 
As with most things in Access, the answer is: It Depends.

1) Global variables have a nasty habit of disappearing under some
conditions, so I rarely use them for values that I want sustain outside a
module.

2) I have often stored values in a textbox on an invisible form, but if the
form gets closed somehow or for some reason never gets opened, it can cause
an error.

3) Tables are good unless it is a multi-user database where the users share
the same MDB. If the database is split with the Front-End on each user's
desktop and the table is local to the FE, then this works fine. But if they
share the same network MDB, then they can trample each other's values.

4) Another method (similar to 3, but without the problems) is to create a
temporary DATABASE on the user's hard drive when the database is opened.
Then values or even whole tables can be stored. When the database closes,
the temporary database itself can be deleted from the hard drive (with the
Kill statement) which is faster than deleting data.

On my website (see sig below) is a small sample database called
"ImportToTempDatabase.mdb" which illustrates #4. It's main purpose is to
show how to import data to a temporary table without bloating the database,
but since it uses a temp database to do this, it also illustrates #4.
 
Back
Top