Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2003
    Location
    Raleigh, NC
    Posts
    183

    Red face Unanswered: OpenForm Problem

    I don't want eveone to have access to one of my form so i have wrote this code and put it in Open Event of form. Now before the form opens it ask me to enter passwrd even if i put wrong passwrd it still opens. Anybody have any idea what's wrong here

    Private Sub Form_Open(Cancel As Integer)
    Dim strPasswd

    strPasswd = InputBox("Enter Password", "Restricted Form")

    If strPasswd = "" Or strPasswd = Empty Then
    MsgBox "No Input Provided", vbInformation, "Required Data"
    Exit Sub
    End If

    If strPasswd = "Test" Then
    DoCmd.OpenForm "audPLTM", acNormal
    Else
    MsgBox "Sorry, you do not have access to this form", vbOKOnly, "Important Information"
    Me.Visible = False
    Exit Sub
    End If
    End Sub
    Skharva

  2. #2
    Join Date
    Feb 2004
    Location
    Houston, Texas
    Posts
    45
    Instead of exit sub you also need docmd.close... to close the form.
    ...rk

  3. #3
    Join Date
    Sep 2003
    Location
    Raleigh, NC
    Posts
    183

    Thumbs up

    Originally posted by rtkracht
    Instead of exit sub you also need docmd.close... to close the form.
    ...rk

    Thanks that wrks fine
    Skharva

Posting Permissions

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