Results 1 to 8 of 8
  1. #1
    AussieAsh is offline Novice
    Windows XP Access 2007
    Join Date
    Jan 2013
    Posts
    7

    LOGIN Form not disappearing


    I have created a login form, however, once i log in correctly it takes me to my main form, but the log in form still stays up over the main form.

    Any ideas on how to get it to disappear once i press 'ok' button on the login form and the username and password are correct?

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,540
    Can you show us the code behind the 'ok' button.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    AussieAsh is offline Novice
    Windows XP Access 2007
    Join Date
    Jan 2013
    Posts
    7
    If Me.pass = "a" Then
    DoCmd.OpenForm "frmMain"
    Else


    If Me.pass = Me.UserPass Then
    DoCmd.OpenForm "frmMain"
    ' DoCmd.OpenForm "DetectIdleTime", acFormDS, , , acFormEdit, acHidden
    Else
    Dim Msg, Style, Title, Response, MyString
    Msg = "You have entered an Incorrect Password. " & vbCrLf & vbCrLf & "Click OK to retry." & vbCrLf & "Cancel to Close." & vbCrLf & vbCrLf & "If you need access to this database please contact s."
    Style = vbOKCancel
    Title = "Incorrect Password"
    Response = MsgBox(Msg, Style, Title)

    If Response = vbOK Then
    Me.pass.SetFocus
    Else
    DoCmd.Quit
    End If
    End If
    End If

  4. #4
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,540
    Perhaps you just need a line of code to close the form. Try:
    Code:
    If Me.pass = "ashley" Then
    DoCmd.OpenForm "frmMain"
    Else
    
    
    If Me.pass = Me.UserPass Then
    DoCmd.OpenForm "frmMain"
    ' DoCmd.OpenForm "DetectIdleTime", acFormDS, , , acFormEdit, acHidden
    DoCmd.Close acForm, "NameOfYourForm"
    Else
    Dim Msg, Style, Title, Response, MyString
    Msg = "You have entered an Incorrect Password. " & vbCrLf & vbCrLf & "Click OK to retry." & vbCrLf & "Cancel to Close." & vbCrLf & vbCrLf & "If you need access to this database please contact Sandra Clark."
    Style = vbOKCancel
    Title = "Incorrect Password"
    Response = MsgBox(Msg, Style, Title)
    
    If Response = vbOK Then
    Me.pass.SetFocus
    Else
    DoCmd.Quit
    End If
    End If
    End If
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  5. #5
    AussieAsh is offline Novice
    Windows XP Access 2007
    Join Date
    Jan 2013
    Posts
    7
    Hmm.. I tried that... got the same result though :-/

  6. #6
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,540
    OK. How about:
    Code:
    If Me.pass = "ashley" Then
    DoCmd.OpenForm "frmMain"
    DoCmd.Close acForm, "NameOfYourForm"
    Else
    
    
    If Me.pass = Me.UserPass Then
    DoCmd.OpenForm "frmMain"
    ' DoCmd.OpenForm "DetectIdleTime", acFormDS, , , acFormEdit, acHidden
    
    Else
    Dim Msg, Style, Title, Response, MyString
    Msg = "You have entered an Incorrect Password. " & vbCrLf & vbCrLf & "Click OK to retry." & vbCrLf & "Cancel to Close." & vbCrLf & vbCrLf & "If you need access to this database please contact Sandra Clark."
    Style = vbOKCancel
    Title = "Incorrect Password"
    Response = MsgBox(Msg, Style, Title)
    
    If Response = vbOK Then
    Me.pass.SetFocus
    Else
    DoCmd.Quit
    End If
    End If
    End If
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  7. #7
    AussieAsh is offline Novice
    Windows XP Access 2007
    Join Date
    Jan 2013
    Posts
    7
    You are a GENIUS!!! Thank you SO much!!

  8. #8
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,540
    Quote Originally Posted by AussieAsh View Post
    You are a GENIUS!!! Thank you SO much!!
    I don't think so but I thank you for your kind words.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Trouble with Disappearing Boxes
    By ineedaccesshelp in forum Forms
    Replies: 10
    Last Post: 11-28-2012, 11:54 AM
  2. disappearing combo box value
    By j6sander in forum Forms
    Replies: 5
    Last Post: 09-11-2012, 10:22 AM
  3. Replies: 1
    Last Post: 12-11-2011, 11:48 AM
  4. Login form with nt login
    By hitesh_asrani_j in forum Forms
    Replies: 6
    Last Post: 09-22-2011, 11:43 AM
  5. The amazing disappearing VBA code
    By Michele Keck in forum Forms
    Replies: 2
    Last Post: 10-01-2010, 11:44 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums