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!

Switchboard - How do I password protect a button?

Status
Not open for further replies.

Remeartificer

Technical User
May 7, 2004
42
0
0
GB
Switchboard - How do I password protect a button?

I have searched how & low and I am now pulling my hair out. 9 out of 10 answers I have googled waffle on and explain poorly.

Basically I need to protect one button on my "Main Switchboard" so the idiots cant access a form. When the idiot clicks this button I want him prompted for a password.

I realise that this is a common question but just when I think I am close to following some instructions I get stumped by some confusing instructions half way through.

If someone has the time, could you explain how I can protect my switchboard please?

Huge thanks in advance :)
 
Something like this would provide a basic password


Dim pswd As String
pswd = InputBox("Please Enter Password", "Password")
If pswd = "Hello" Then
DoCmd.OpenForm "Secretform", acNormal, "", "", acFormEdit
Else
MsgBox "Incorrect Password"
End If

Although there are always ways around it.
 
Create a NEW command button on your switchboard. Place the code below in the On Click Event of your command button. Then replace "Password" with your password.
Then replace "frmname" with the name of the form you want the user to open.


Dim PassWord As String
PassWord = InputBox("Enter Password")
If PassWord = "Password" Then
' Open Form
DoCmd.OpenForm "frmname"
DoCmd.GoToRecord , , acNewRec
Else
MsgBox ("You're not authorized")
End If


Hope this helps!!!!

Thomas Bailey
a/k/a TomCat
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top