Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Locate passwords in a single module 2

Status
Not open for further replies.

kennetha

Programmer
Sep 10, 2003
105
0
0
MT
In a database I have 3 passwords to unlock command buttons but are spread all over the code in public subs. Can i use a module and place const.s there? In doing so I can access to these passwords and change them easily, rather then going all to the code!
thx in advance
kenneth
 
Good Afternoon kennetha!

Yes,I do it this way and as long as the file is open the username and passwords may be used at any time.

I first create a Class Module and name the properties. I named the class clsLogOn.
********************************************************

Public Property Get PASSWORD_1() As Variant
PASSWORD_1 = PasswordValidationFuction(mPassWord_1)
End Property

Public Property Let PASSWORD_1(ByVal vNewValue As Variant)
mPassWord_1 = vNewValue
End Property
Public Property Get PASSWORD_2() As Variant
PASSWORD_2 = PasswordValidationFuction(mPassWord_2)
End Property

Public Property Let PASSWORD_2(ByVal vNewValue As Variant)
mPassWord_2 = vNewValue
End Property

Public Property Get PASSWORD_3() As Variant
PASSWORD_3 = PasswordValidationFuction(mPassWord_3)
End Property

Public Property Let PASSWORD_3(ByVal vNewValue As Variant)
mPassWord_3 = vNewValue
End Property

************************************************************
Please note that I also have listed the method "PasswordValidationFunction" to check whether the password is good or not. I'll that up to you to use or not use.

The next step is to create a global standard module:
I call this "basGlobal" and have only the following statements in them beneath the Option Explicit statement. I can't remember if I used Public or Dim. It may not make a difference in this case.
******************************************************
Public gPassWord_1 As clsLogOn
Public gPassWord_2 As clsLogOn
Public gPassWord_3 As clsLogOn

Then in the modules where the passwords are to be used, put the "Set" statements in them:

Set gPassWord = New clsLogOn

gPassWord.PASSWORD_1 = Me.txtPassword
*******************************************************

When the form closes, the property values persist while the file is open. You can use it like a global variable anywhere.

Good luck and hopefully this will help.

Sincerely,

Smuckers
 
Im Ms. A., unless you create an ".MDE" version, the code is generally available to users, so saving passwords within the db is -at best- poor practice. Ms. A. has a reasonable secutiry sysyem, which you should utilize. It can be somewhat daunting, but a bit of study and practice (on dummy dbs) is generally sufficient. Using the supplied security may provide additional benefits, as it makes the user's name (UserName) available for various other functions, such as logging 'who done it' and finding out who is working (at least to some extent).



MichaelRed
m.red@att.net

Searching for employment in all the wrong places
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top