Results 1 to 3 of 3
  1. #1
    thomanmpku is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2013
    Posts
    1

    create form login with pasword


    how to create login with pssword form in access 2007

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    This is a common topic in forum. A search will return many threads.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    maxmaggot is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2013
    Location
    Ireland
    Posts
    91
    Create a table called Users with the following fields
    UserID - Autonumber
    UName - text
    PWord - text
    Status - in or out

    Create form for your login screen, Include a textbox for Usrname and password and a button saying login

    In hte OnClick event of the login button put in the following code

    Code:
    Private Sub cmdLogin_Click()
        
        Dim strFilter As String, strAdmin As String
        
        Call txtUname.SetFocus
        If IsNull(Me.txtUname) Then
            MsgBox "Please enter Username and Password", vbCritical, "Login Error"
            Exit Sub
        End If
        
        Call txtPword.SetFocus
        If IsNull(Me.txtPword) Then
            MsgBox "Please enter Username and Password", vbCritical, "Login Error"
            Exit Sub
        End If
    
        strFilter = "(([Uname]='%U') AND ([Pword]='%P'))"
        strFilter = Replace(strFilter, "%U", Me.txtUname)
        strFilter = Replace(strFilter, "%P", Me.txtPword)
        strAdmin = Nz(DLookup("[UserID]", "[Users]", strFilter), "Fail")
        
        If strAdmin = "Fail" Then
            lblLoginSuccess.Visible = True
            lblLoginSuccess.ForeColor = 255
            lblLoginSuccess.Caption = "Incorrect Username or Password"
            BMLT.[Form_Navigation Form].navGeneralInformation.Visible = False
            BMLT.[Form_Navigation Form].navIncome.Visible = False
            BMLT.[Form_Navigation Form].navExpenses.Visible = False
            BMLT.[Form_Navigation Form].navRegistration.Visible = False
            
        Else
            lblLoginSuccess.Visible = True
            lblLoginSuccess.ForeColor = 0
            lblLoginSuccess.Caption = "Login Successful"
            BMLT.[Form_Navigation Form].navGeneralInformation.Visible = True
            BMLT.[Form_Navigation Form].navIncome.Visible = True
            BMLT.[Form_Navigation Form].navExpenses.Visible = True
            BMLT.[Form_Navigation Form].navRegistration.Visible = True
            BMLT.[Form_Navigation Form].Start_Screen.Enabled = False
            BMLT.[Form_Navigation Form].navRegistration.SetFocus
            SendKeys ("{ENTER}")
            'DoCmd.BrowseTo ObjectType:=acBrowseToForm, ObjectName:="Registration"
            
        End If
    End Sub
    My code will open certain forms based on the users credentials. You'll probably be able to remove some of the code I;ve posted.

    Best of luck
    Last edited by maxmaggot; 08-29-2013 at 06:51 PM. Reason: Updated code

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

Similar Threads

  1. Replies: 4
    Last Post: 05-29-2012, 01:32 PM
  2. Having trouble visualizing how to create a login
    By seth.murphine in forum Access
    Replies: 19
    Last Post: 04-11-2012, 03:24 PM
  3. Replies: 4
    Last Post: 12-19-2011, 12:16 PM
  4. Replies: 1
    Last Post: 12-11-2011, 11:48 AM
  5. Login form with nt login
    By hitesh_asrani_j in forum Forms
    Replies: 6
    Last Post: 09-22-2011, 11:43 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