PDA

View Full Version : Prompt for password on BeforeUpdate



fjcordoba007
11-27-2007, 10:32 AM
Hi everyone.
I'd like to know if I can prompt for a password in BeforeUpdate in a form.
Im using 2007 Access, so it's been messy trying to change from users to new security.
I already have a confirmation message that shows up before update, but i want to get a window that prompts for a password if the answer to the previous question is yes. : pray2:
Thanks a lot.

akn112
11-27-2007, 01:49 PM
depending on how particular u are about the password box, it could be quick or slow. Quick solution would be to use inputbox. problem with that is you can't format your password into ***** while the user is typing.

Only other way is to create a custom form. This is the way i did it for mine.

fjcordoba007
11-27-2007, 02:38 PM
Thanks!
Now, what should I do in order to make the custom form able to restrict wheater the form opens or not?
Do I need a password table?

asingh
11-28-2007, 03:07 AM
Hi,

You could use a password table..where the password is verified from...after the user inputs it...or you could hard-code the password into the VBA code.....depends how dynamic you want the module..?

regards,

asingh

akn112
11-28-2007, 07:51 AM
here's a quick example. I havent found a better way to pass the password from the password box to the form, but this way works. basically passes it to your original form through a hidden label. Check out the coding behind it and it might make more sense

HTH

DarkSprout
11-29-2007, 08:39 AM
This should do it on the BeforeUpdate Event of the Form:


Private Sub Form_BeforeUpdate(Cancel As Integer)
Cancel = Nz(InputBox("Please Enter Password To Add/Edit Entries", "Password?"), "") <> Nz([HiddenPasswordBox], "")
End Sub