472,958 Members | 1,785 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,958 software developers and data experts.

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 2207
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
by: Paul Rubin | last post by:
I've had this recurring half-baked desire for long enough that I thought I'd post about it, even though I don't have any concrete proposals and the whole idea is fraught with hazards. Basically...
0
by: obhayes | last post by:
Hi All, Im using classic ASP (3.0) and I have a web farm with 2 webservers (webserver A and webserver B, both windows server 2003). I do not want to store any client specific information on the...
1
by: brad | last post by:
Hi, Im using classic ASP (3.0) and I have a web farm with 2 webservers (webserver A and webserver B, both windows server 2003). I do not want to store any client specific information on the...
2
by: Eric Ellsworth | last post by:
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...
1
by: Marco Rispoli | last post by:
I am using this function to write a cookie: private static void SaveCookie(string CookieName, string CookieValue, bool Persistent) { HttpContext.Current.Response.Cookies.Value = CookieValue;...
0
by: Kepler | last post by:
I'm testing very basic FormsAuthentication and having trouble with non-persistent cookies. Once authenticated with a non-persistent cookie, if I leave the browser alone for 30 minutes,...
2
by: nacho222 | last post by:
I'm currently in the middle of writing a persistence framework, and I have to make a design decission. The framework will take care of all the saving and restoring objects, and also the...
0
by: robert | last post by:
I have noticed in .net 2 that when authenticating a user, setting the cookie using either redirectfromloginpage or setauthcookie, specifying true for the persistent parameter that the cookie is...
3
by: sanchita | last post by:
Hello everyone, I didn't get any response in "Security" forum hence posting here again. I am having problem with persistent cookies. Even after setting "CreatePersistentCookie" to true in...
11
by: =?Utf-8?B?bWljaGFlbCBzb3JlbnM=?= | last post by:
I have worked with application settings in VS2005 and C# for awhile, but usually with standard types. I have been trying to store a custom container/class/type in an application setting and I have...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.