Storing a persistent value

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Eric Ellsworth

    Storing a persistent value

    Hi,
    I'm working on an Access database which eventually be connected to an
    ODBC data source (probably postgres), but for now has an .mdb backend.
    The idea is to use the password to authenticate with postgres when we go
    to it. I'm using the ebCrypt library to md5 hash passwords and store
    them hashed in a password table.

    For the moment I would like to use this system to authenticate without
    dealing with Access security. I have written functions that check the
    password against the password table and set values showing who is
    authenticated. The problem is that whenever an error is raised, if the
    user chooses the End button, the "project" memory is cleared and the
    user appears to no longer be authenticated. Can anyone tell me how to
    make these values persist until Access is closed?

    Thanks,

    Eric
  • MGFoster

    #2
    Re: Storing a persistent value

    Eric Ellsworth wrote:
    [color=blue]
    > Hi,
    > I'm working on an Access database which eventually be connected to an
    > ODBC data source (probably postgres), but for now has an .mdb backend.
    > The idea is to use the password to authenticate with postgres when we go
    > to it. I'm using the ebCrypt library to md5 hash passwords and store
    > them hashed in a password table.
    >
    > For the moment I would like to use this system to authenticate without
    > dealing with Access security. I have written functions that check the
    > password against the password table and set values showing who is
    > authenticated. The problem is that whenever an error is raised, if the
    > user chooses the End button, the "project" memory is cleared and the
    > user appears to no longer be authenticated. Can anyone tell me how to
    > make these values persist until Access is closed?[/color]

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    When an unhandled error occurs & the user clicks the "End" button on the
    Error notification message box the global variables' values are cleared.
    To avoid the clearing of variables you need to write some error
    handling routines in all procedures that will cause an error. The
    easiest is this:

    Put this line at the beginning of a procedure, before any program lines:

    On Error GoTo err_

    After the procedures program lines, but something like the following:

    exit_:
    Exit Sub ' or Function, depends on the type of procedure

    err_:
    MsgBox "An error occurred" & vbcr & vbcr & _
    "Error: " & err.description , vbExclamation
    Resume exit_

    Now every time an error occurs in that procedure it will be "handled" by
    the program lines under the "err_:" label, and then resume at the
    "exit_:" label, which leaves the procedure. All currently loaded global
    variables will not lose their values.

    If you wish you can make the error MsgBox more descriptive, so you can
    fix the error (bug).

    --
    MGFoster:::mgf0 0 <at> earthlink <decimal-point> net
    Oakland, CA (USA)

    -----BEGIN PGP SIGNATURE-----
    Version: PGP for Personal Privacy 5.0
    Charset: noconv

    iQA/AwUBQICPi4echKq OuFEgEQKkCwCfdO S/oRUv1ixixJQF0cD rBl/muIsAniEG
    ioSDoz2qzwTde5Z P/C89AR+C
    =iSpT
    -----END PGP SIGNATURE-----

    Comment

    • Eric Ellsworth

      #3
      Re: Storing a persistent value

      Hi MG,
      Thanks for the idea to use error handling. My experience has been that
      during development and initial testing, there are almost always errors
      that my error handler doesn't catch, and therefore require pressing
      "End" to escape the sequence. That's why I want to be able to pick up
      the value from a persistent location, but have it be flushed at the end
      of the Access session.

      Thanks,

      Eric

      MGFoster wrote:[color=blue]
      > Eric Ellsworth wrote:
      >[color=green]
      >> Hi,
      >> I'm working on an Access database which eventually be connected to
      >> an ODBC data source (probably postgres), but for now has an .mdb backend.
      >> The idea is to use the password to authenticate with postgres when we
      >> go to it. I'm using the ebCrypt library to md5 hash passwords and
      >> store them hashed in a password table.
      >>
      >> For the moment I would like to use this system to authenticate without
      >> dealing with Access security. I have written functions that check the
      >> password against the password table and set values showing who is
      >> authenticated. The problem is that whenever an error is raised, if
      >> the user chooses the End button, the "project" memory is cleared and
      >> the user appears to no longer be authenticated. Can anyone tell me
      >> how to make these values persist until Access is closed?[/color]
      >
      >
      > -----BEGIN PGP SIGNED MESSAGE-----
      > Hash: SHA1
      >
      > When an unhandled error occurs & the user clicks the "End" button on the
      > Error notification message box the global variables' values are cleared.
      > To avoid the clearing of variables you need to write some error
      > handling routines in all procedures that will cause an error. The
      > easiest is this:
      >
      > Put this line at the beginning of a procedure, before any program lines:
      >
      > On Error GoTo err_
      >
      > After the procedures program lines, but something like the following:
      >
      > exit_:
      > Exit Sub ' or Function, depends on the type of procedure
      >
      > err_:
      > MsgBox "An error occurred" & vbcr & vbcr & _
      > "Error: " & err.description , vbExclamation
      > Resume exit_
      >
      > Now every time an error occurs in that procedure it will be "handled" by
      > the program lines under the "err_:" label, and then resume at the
      > "exit_:" label, which leaves the procedure. All currently loaded global
      > variables will not lose their values.
      >
      > If you wish you can make the error MsgBox more descriptive, so you can
      > fix the error (bug).
      >[/color]

      Comment

      Working...