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

Password if then statement

Status
Not open for further replies.
Dec 5, 2005
40
US
Hi, I have a form that will have a place for the user to enter a password. I want to use visual basic to compare what the user enters against the field on the form (hidden) and run macro 1 if it matches, run macro 2 if it does not.

Any help would be appreciated.
Thanks

field names
PIN(field name where user enters a PW)
UserPW (defined in table and hidden on form)
macro1 (will run a query to add data to a table)
macro2 (will bring up a form saying wrong PIN, try again)
 
1) Add a button to your form for the user to click after they enter the password.
2) In the buttons Click Event put...

If Me.PIN = Me.UserPW Then
DoCmd.RunMacro "Macro1"
Else
DoCmd.RunMacro "Macro2"
End if

ProDev, Builders of Affordable Software Applications
Visit me at ==>
May God bless you beyond your imagination!!!
 
Instead of macro2 and another form, why not just use an input box?

Or

You could just pop up a messagebox telling them the password was wrong and place the cursor back in the textbox with the previous input cleared.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top