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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Command Button Password

Status
Not open for further replies.

Kosmo2

Technical User
Mar 21, 2002
18
CA
Hi,

I would like to create a Command button (basically a Yes/no Button) on a form that is password protected , essientially when you click on it I want it to ask you for a Password before it will operate . . any Ideas anybody ??


Thanks
 
One quick solution is to use the onclick event... Use an Inputbox to ask the user for a password. If the password does not match a hard-coded value (or database value or encrypted value) then exit the onclick event. htwh Steve Medvid
"IT Consultant & Web Master"
 
Hi Steve,
Thanks for the response , Actually I am a complete newbie at Access and was looking for help with the actual code for the event to do this operation . . . anywhere you can point me would be helpfull


Thanks
 
Here is a quick sample from a command button that launches a data entry form... Remember the only way to learn is to experiment...


htwh...

Private Sub Command1_Click()
On Error GoTo Err_Command1_Click

Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Form1"

Dim strInput As String
Dim strMsg As String
strMsg = "Enter your password:"
strInput = InputBox(Prompt:=strMsg, Title:="Password Entry", XPos:=2000, YPos:=2000)
MsgBox (strInput) 'Just to see if it is working...
If strInput = "super" Then
MsgBox ("You Entered the correct password") 'Remove later
'DoCmd.OpenForm stDocName, , , stLinkCriteria 'Uncomment later
Else
MsgBox ("You Entered the WRONG password!")
Exit Sub
End If


Exit_Command1_Click:
Exit Sub

Err_Command1_Click:
MsgBox Err.Description
Resume Exit_Command1_Click

End Sub
Steve Medvid
"IT Consultant & Web Master"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top