ANYONE KNOW ABOUT PASSWORDS????

DaleFromEngland

Registered User.
Local time
Today, 19:37
Joined
Jul 16, 2001
Messages
15
Hi... Fairly NEW to VBA programming, i hav done Visual Basic... Well i will stop talking daft... Here goes..........

I have a CMD button on a form, that has been set to a macro. This marco does a append and delete query in one.. So records from one table will be sent to another table (TO STORE RECORDS)
I dont want user to be able to click on this button, so i have disabled the button... But is there a way, to prompt for a password when the user tries to access the button....

So is there anywhere of doing this, i would be grateful to hear from anyone.

Thanx's in advance
 
An easy way to do it would be: instead of calling the macro directly from the button, have the button open a second form that has a textbox (we'll call it txtPwd) and a button (btnGO; label it GO). Label the text box "Password" and put a password Input Mask on it (set from the Properties -> Input Mask; use the wizard and one of the options is Password). The user can then type the password into it and it will show up as the ****'s.

On the OnClick event of the GO button, use the following code:

-------------
Private Sub btnGO_Click()
Dim msg As String

If txtPwd = "password" Then
DoCmd.RunMacro "MacroName"
Else
MsgBox "The password was incorrect.", vbExclamation, "Incorrect Password"
End If

End Sub
-------------

It's not very secure b/c anyone can look at your code and see what the password is, but it would work if you don't need extrememly tight security. If your DB is secure, there might even be a way to compare the value of txtPWD to the user's login password, but my help files are messed up right now so I could research it. Sorry!

Hope this helps!

jamie
 
I've never been to happy with the way Access security works, so I recently wrote my own. I configured the startup to immediatly open a login form which looks to a binary file on the hard disk. The name of the binary file is ever changing in location and name. The contents of the binary file consist of the username, a random encryption value and each character of the password stored separatly after the ascii value is multiplyied by the encryption value.

Hopefully this can work for you.

Keagan Quilty
Kilbride, Newfoundland
 

Users who are viewing this thread

Back
Top Bottom