Password protect a button that opens a form

  • Thread starter Sarah at DaVita
  • Start date
S

Sarah at DaVita

I have a button that opens a form. I would like to make it so when clicked
it asks for a password if it gets what it expects it will open that form. If
the wrong or no password is entered I want it give a message and end
processing so the user just stays on the form they are on. Can someone help
me with that?
 
G

Golfinray

Private Sub Command0_Click()
Dim strpassword As String
strpassword = InputBox("enter your password")
If strpassword = "Your Password" Then
DoCmd.OpenForm "Your Form"
Else: End If
DoCmd.Close acForm, "Your Form"
End Sub
 
G

Golfinray

I forgot to mention, go to the onclick event of the form (click on the black
box in upper left hand corner), click on the code builder, type this in.
Golfinray
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Form wrangle 2
Password Protect Form 4
Password protect code 2
Form button opens blank form 10
Verify User-Group Level Password 6
Excel Protection 2
Auto Form Close 2
Access Sub form opens before the main form in MS Access 0

Top