Ask for password using macro

Ask for password using macro

Post by U2FtIEt1b » Sat, 24 Jul 2004 12:07:09


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
 
 
 

Ask for password using macro

Post by VGhlb » Sat, 24 Jul 2004 21:27:01

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.

 
 
 

Ask for password using macro

Post by Jim/Chri » Tue, 27 Jul 2004 22:53:03

See these knowledge base articles:
1 - http://www.yqcomputer.com/
2 - http://www.yqcomputer.com/

Jim

before opening another form upon a click of a command
button. Is this possible with a macro?
the form with correct password entered? Thanks for any help!