disappearing value (1 Viewer)

bauer

Registered User.
Local time
Today, 07:47
Joined
Aug 23, 2001
Messages
77
I tried making my own security for a databse of mine, and I have a recurring problem.
In order to keep the state of security, I use a variable to hold what security level this user has. For some odd reason every so often the variable will sort of lose this value, and in essence log a person out (I have as a default no permissions if there is no value in this variable).

If anyone can please explain to me why this might be happening, or maybe even a fix, I would greatly appreciate it.

In case you were wondering why I made my own, I did this b/c I didn't want all access databases under this security.

Bauer
 

jwindon

Registered User.
Local time
Today, 12:47
Joined
Aug 12, 2001
Messages
531
Are you keeping the value in a Public module? If the user moves from form to form, that "username" will need to be checked during each move the way I understand. Just a thought.
 

bauer

Registered User.
Local time
Today, 07:47
Joined
Aug 23, 2001
Messages
77
I have it as such:
Public UserID As Long
in a module
 

jwindon

Registered User.
Local time
Today, 12:47
Joined
Aug 12, 2001
Messages
531
So on the onload event of your forms and things you are calling the module and checking the value against some kind of "permissions" list?
 
R

Rich

Guest
I have found when using this method that you need to set the variable several times if you are referencing it regularly. I usually use a few crucial forms that I know have to be opened.
HTH
 

bauer

Registered User.
Local time
Today, 07:47
Joined
Aug 23, 2001
Messages
77
jwindon: yes

Rich: I'm sorry, but I didn't understand. How and when do you set the variable several times?
I have a log in form where they log in, and there I set the variable. When else should I do it?

Thanks
 

jwindon

Registered User.
Local time
Today, 12:47
Joined
Aug 12, 2001
Messages
531
Try first throwing a few message boxes on your form events to narrow down which forms, etc are not keeping the user name. Maybe there is a logic error going on somewhere.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 07:47
Joined
Feb 19, 2002
Messages
43,445
I've experienced a similar problem but only when the database was still under development. Untrapped errors seemed to cause the problem. So, I started using a hidden form to hold the values I needed throughout a session. This seems to be more stable.
 

bauer

Registered User.
Local time
Today, 07:47
Joined
Aug 23, 2001
Messages
77
to Jwin: I have made a form that I use to constantly check who is logged on, and I think it is like Pat was saying that when an error happens.
I think I'll try putting it on a form. Thank you!

Bauer
 

Users who are viewing this thread

Top Bottom