Ask for password using macro

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I would like to create a macro that asks user for password before opening another form upon a click of a command button. Is this possible with a macro?

Or maybe some VBA code that asks for password and opens the form with correct password entered? Thanks for any help!

Regards,
Sam
 
Create a Macro that does the following:
1) "OpenForm" command and select the form you wish users to view after entering the password.
2)"Close" command that closes form "frmPassword"
Save Macro as e.g. "OpenPassword"

Create a new form (frmPassword) with a text box (TxtBoxPassword) and command button.
Right click on the command button,Go To "On Click" Procedure.
Select Event Procedure.
Code:
If me.TextBoxPassword = "Type Password Here" then
Docmd.RunMacro "OpenPassword"
Else
MsgBox "Incorrect Password.Please Try Again"
End If
End Sub

-What happens is that when you type the password in the Textbox and click on the command button, The coding will check if the password typed = the hardcoded password.If it's true, It'll run the macro to open the new form.

Hope this helps.
 
See these knowledge base articles:
1 -http://support.microsoft.com/?id=209871
2 -http://support.microsoft.com/?id=179371

Jim
-----Original Message-----
Hi,
I would like to create a macro that asks user for password
before opening another form upon a click of a command
button. Is this possible with a macro?
Or maybe some VBA code that asks for password and opens
the form with correct password entered? Thanks for any help!
 
Back
Top