Results 1 to 2 of 2
  1. #1
    MdHaziq is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Sep 2017
    Location
    Singapore
    Posts
    124

    Sign up form followed by Login form

    Hello forum,



    I have 2 forms that I would like to work in steps.

    I want the program to display a login page (form).

    In the form, I want to have an option for users to sign up if they do not have an account.

    After they have done so. They can go back to the login form to enter the database.
    I do not have a database yet though. and my sign-up page cannot be entered as I do not know how to insert the data users enter in the form to the table.

    I have attached the MS Access doc.

    Can someone please help me out?

    Thanks.

    Yours Sincerely,
    Haziq
    Attached Files Attached Files

  2. #2
    ranman256's Avatar
    ranman256 is online now VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    youd want an unbound form, let users enter data, click Save,
    then perform checks:
    does this user exist?
    Code:
    'get their loginiD as key.
    vID= Environ("Username")
    vDbID = Dlookup("[userId]","tUsers","[UserID]='" & vID & "'"
    if vDbid = vid then
       msgbox "This ID exists"
    else
             'if not, run an append query to add the form info to the table.
       docmd.openquery "qaAddNewUser"
    endif
    then open the login form.
    no need to store passwords, just use the windows login/password to authenticate.

    Code:
    '-------------
    Private Sub btnLogin_Click()
    '-------------
    Dim sUser As String, sPass As String, sDom As String
    dim vID, vDbID
    
    
    sUser = txtUser
    sPass = txtPass
    sDom = txtDom
    
    
    vID= Environ("Username")
    vDbID = Dlookup("[userId]","tUsers","[UserID]='" & vID & "'"
    
    
    If WindowsLogin(sUser, sPass, sDom) and vID = vDbID Then
       mbSafe = True
       DoCmd.OpenForm "frmMainMenu"
       DoCmd.OpenForm "frmLogin"
       DoCmd.Close
    Else
       MsgBox "LOGIN INCORRECT", vbCritical, "Bad userid or password"
    End If
    End Sub
    
    
    
    
    '-------------
    Public Function WindowsLogin(ByVal strUserName As String, ByVal strpassword As String, ByVal strDomain As '-------------
    String) As Boolean
            'Authenticates user and password entered with Active Directory.
    
    
            On Error GoTo IncorrectPassword
            
            Dim oADsObject, oADsNamespace As Object
            Dim strADsPath As String
            
            strADsPath = "WinNT://" & strDomain
            Set oADsObject = GetObject(strADsPath)
            Set oADsNamespace = GetObject("WinNT:")
            Set oADsObject = oADsNamespace.OpenDSObject(strADsPath, strDomain & "\" & strUserName, strpassword, 0)
            
            WindowsLogin = True    'ACCESS GRANTED
            
    ExitSub:
            Exit Function
            
    IncorrectPassword:
            WindowsLogin = False   'ACCESS DENIED
            Resume ExitSub
    End Function

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

Similar Threads

  1. Sign up and Login page
    By MdHaziq in forum Access
    Replies: 22
    Last Post: 09-26-2017, 05:15 PM
  2. Replies: 5
    Last Post: 03-30-2016, 12:42 PM
  3. Replies: 2
    Last Post: 04-17-2015, 10:59 AM
  4. Replies: 35
    Last Post: 09-19-2011, 10:13 AM
  5. Daily Sign In form
    By JHansford in forum Access
    Replies: 2
    Last Post: 12-09-2009, 08:41 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