Eric Ellsworth wrote:
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?
-----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:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv
iQA/AwUBQICPi4echKqOuFEgEQKkCwCfdOS/oRUv1ixixJQF0cDrBl/muIsAniEG
ioSDoz2qzwTde5ZP/C89AR+C
=iSpT
-----END PGP SIGNATURE-----