470,863 Members | 1,150 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,863 developers. It's quick & easy.

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
Nov 12 '05 #1
2 2117
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-----

Nov 12 '05 #2
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:
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).

Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

16 posts views Thread by Paul Rubin | last post: by
2 posts views Thread by Eric Ellsworth | last post: by
1 post views Thread by Marco Rispoli | last post: by
3 posts views Thread by sanchita | last post: by
11 posts views Thread by =?Utf-8?B?bWljaGFlbCBzb3JlbnM=?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.