Password protecting a button

G

Guest

Hello:

I've got a button on my main form that leads to a form that I would like to
limit access to. I recall that there is a way to password protect a button. I
believe that I saw this done with code a few years ago. If your suggestion
involves coding could you please supply the code seeing how my VB skills have
deteriorated from non-use over the past few years.

Thank you,
 
N

Nick via AccessMonster.com

Hello,

A simple password protection would look something like this:

(This code goes in the Click event of your button, before any other code)

If strYourPassword = Inputbox("Enter the password") Then
'Allow user to continue to next form
Else
Msgbox "You did not enter the correct password."
Exit Sub
End If

Where strYourPassword is (obviously) the password you would want.

Nick
 

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

Top