Consulting

Results 1 to 6 of 6

Thread: Prompt for password on BeforeUpdate

  1. #1
    VBAX Newbie fjcordoba007's Avatar
    Joined
    Nov 2007
    Location
    Boynton Beach, FL
    Posts
    2
    Location

    Prompt for password on BeforeUpdate

    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.
    Thanks a lot.

  2. #2
    VBAX Contributor
    Joined
    Jan 2007
    Posts
    146
    Location
    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.

  3. #3
    VBAX Newbie fjcordoba007's Avatar
    Joined
    Nov 2007
    Location
    Boynton Beach, FL
    Posts
    2
    Location
    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?

  4. #4
    VBAX Mentor asingh's Avatar
    Joined
    Jul 2005
    Posts
    307
    Location
    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

  5. #5
    VBAX Contributor
    Joined
    Jan 2007
    Posts
    146
    Location
    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

  6. #6
    VBAX Contributor DarkSprout's Avatar
    Joined
    Oct 2007
    Location
    Essex, England
    Posts
    144
    Location
    This should do it on the BeforeUpdate Event of the Form:

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

    "Give a person a fish and you feed them for a day; teach a person to use the Internet and they won't bother you for weeks."

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •