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

Password on a single control 1

Status
Not open for further replies.

gRegulator

Technical User
Jul 3, 2003
133
CA
Hi,

Is it possible to put a password on a single control, so that only authorized persons can use the control?

For example, I have a command button, cmdEnter, which I want to put a password on, so when the password is entered correctly, another form, frmMain, will open.

Greg
 
You could write a procedure attached to the button's OnClick event, and prompt the user for the password using an InputBox() function. The downside to this is that the password will be embedded in your code.
 
Mark, I wouldn't mind having the password in the code...Do you know how I could write this?
 
If InputBox("Please enter the password") = "Password" then
docmd.openform "frmName"
else
msgbox "Incorrect Password"
end if

The inputbox function has some other features which let you specify a caption for the form, a default value for the entry text, and the x and y position for the form onscreen.

InputBox(prompt[, title] [, default] [, xpos] [, ypos] [, helpfile, context])




 
Mark,

Thank you so very much!! You saved my life!!

Greg
 
Not really a very secure way of doing this unless you compile DB into a .MDE file.

Do you use standard access security as well as password protecting the commandButton or are you building your security into your code?
 
Faery, Actually I did secure it as a mde file so it should be okay. The security is built into the codes for the mde. Also, only users specified to have access to this particular folder on our network will be able to open the program.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top