Results 1 to 8 of 8
  1. #1
    Join Date
    May 2004
    Posts
    159

    Unanswered: any ideas on storing a single variable permanetly

    does anyone have a code function for storing a value that will last a shutdown and restart? I would like to store a single value like an update date to check on restarting. The tag property of a form is not strored permanently only while the program is running and I did not want to make a table just for that value.

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Hi William

    You would have to store it on disk or persist it in memory (perhaps by creating and starting another application to store the variable). When shutdown, Access is removed from memory and so are all the variables.

    Making a table is certainly simpler than writing to and reading from the disk or creating a second app merely to store the var.

    HTH
    Testimonial:
    pootle flump
    ur codings are working excelent.

  3. #3
    Join Date
    May 2005
    Posts
    150
    what about having a Public Variable and on the first form that opens up set the variable?

  4. #4
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Quote Originally Posted by pootle flump
    Hi William

    You would have to store it on disk or persist it in memory (perhaps by creating and starting another application to store the variable). When shutdown, Access is removed from memory and so are all the variables.

    Making a table is certainly simpler than writing to and reading from the disk or creating a second app merely to store the var.

    HTH
    But what if the hard drive fries? ... He wants to get that date no matter what ... It might have to wait until we get electromagnetic flux computers (that strange emission around programmer workstations) or when the quantum particle computer comes on line ... Just hold your breath ... Otherwise you've just did a hard format ...
    Back to Access ... ADO is not the way to go for speed ...

  5. #5
    Join Date
    Jan 2003
    Location
    Minneapolis
    Posts
    58
    Perhaps a module that runs when the database is opened which then defines a global constant?

  6. #6
    Join Date
    Feb 2004
    Location
    Chicago, IL
    Posts
    1,312
    I haven't done it myself, but you could use the registry. Here is an article from Microsoft.com

    http://support.microsoft.com/kb/q145679/

    Another possibility is storing the value in a small text file. You will probably want to use the Autoexec macro to set the variable or have the database open a specific form when the database opens.

    An issue that you might have (depends on your circumstance) is setting a new value when shutting down. There really isn't an event that you can use to save the setting when closing.

  7. #7
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    Registry should work - but, and its a big but it will only work in a single user application.

    I often find a use for a configuration table holding all manner of odd information such as financial year, site location / identity, timestamp process x last ran.

    I'm sure it totally goes against normalisation and 'good' dataabase design practises but its a usefull glory hole to reference such configuration issues.

    it often takes the form
    paramID - the key for thre parameter (often string )
    ParamDesc - a description for (human) reference purposes
    ParamValue - a numeric value
    ParamText - a string value

    Its never 'nice' but it works. The main problem is ensuring that critical information is not deleted or if it is deleted or modified then how do you recover clean values.

  8. #8
    Join Date
    Jun 2003
    Location
    USA
    Posts
    1,032
    Perhaps you could store the info in a field in a table in the database.

    But if you don't need the value to survive even after the database is closed what I often do is store it in an invisible control on the main menu form which is a form that is always open underneath other forms that may happen to be open.
    J. Paul Schmidt, Freelance Web and Database Developer
    www.Bullschmidt.com
    Access Database Sample, Web Database Sample, ASP Design Tips

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •