Results 1 to 8 of 8
  1. #1
    Derrick T. Davidson is offline Competent Performer
    Windows 8 Access 2010 64bit
    Join Date
    Mar 2013
    Posts
    142

    Classic Log In Form

    I followed the tutorial from XIPooo on creating a classic Log in form, below is the code I wrote:

    Option Compare Database
    Option Explicit



    Private Sub btnLogin_Click()
    Dim rs As Recordset
    Set rs = CurrentDb.OpenRecordset("LogIn_tbl", dbOpenSnapshot, dbReadOnly)
    rs.FindFirst "UserName='" & Me.txtUserName & "'"
    If rs.NoMatch = True Then
    Me.lblwronguser.Visible = True
    Me.txtUserName.SetFocus
    Exit Sub
    End If

    Me.lblwronguser.Visible = False

    If rs!Password <> Me.txtPassword Then
    Me.lblwrongpassword.Visible = True
    Me.txtPassword.SetFocus
    Exit Sub
    End If

    Me.lblwrongpassword.Visible = False

    DoCmd.Close acForm, "LogIn_frm"
    DoCmd.OpenForm "Home_frm"
    End Sub

    The problem I have when I enter a wrong user name it works fine, however when I hit enter or click the Log In Button after entering the correct user name it skips the password entry and closes the form without a password. The tutorial was shown for 2013 I am running 2010 is there a difference in programming?

    Or I have I coded the second part of the routine wrong???

  2. #2
    burrina's Avatar
    burrina is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    What exactly do you need from your Login form? Just user name and password or more?

  3. #3
    Derrick T. Davidson is offline Competent Performer
    Windows 8 Access 2010 64bit
    Join Date
    Mar 2013
    Posts
    142
    Just Name and Password I followed the tutorial here diligently (I thought) but I must have missed a dot or a comma I guess

  4. #4
    burrina's Avatar
    burrina is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383

    Basic Login Form

    I will try and upload one later.
    Last edited by burrina; 07-18-2014 at 02:09 AM. Reason: Passwords

  5. #5
    burrina's Avatar
    burrina is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    I posted a DEMO in Sample Databases.

    HTH

  6. #6
    Derrick T. Davidson is offline Competent Performer
    Windows 8 Access 2010 64bit
    Join Date
    Mar 2013
    Posts
    142
    I checked the demo and it looks great, however it will not work on my 2010 as I get this message:

    "Compile Error
    The code on this project must be updated for use on a 64 bit system.
    Please review and update Declare statements and then mark them with the PtrSafe attribute."

  7. #7
    burrina's Avatar
    burrina is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383

    64 Bit PtrSafe

    Okay! Then add this to the Module. modCloseCommand That should fix it.

    'Use PtrSafe after Delcare in Declaration Statements.'Example:
    Private Declare PtrSafe Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hDC As Long) As Long
    Attached Thumbnails Attached Thumbnails PtrSafe.png  
    Last edited by burrina; 07-18-2014 at 05:12 AM. Reason: Illustration

  8. #8
    Derrick T. Davidson is offline Competent Performer
    Windows 8 Access 2010 64bit
    Join Date
    Mar 2013
    Posts
    142
    Cool thanks so much

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

Similar Threads

  1. Creating a Classic Login Screen
    By Xipooo in forum Tutorials
    Replies: 1
    Last Post: 02-03-2016, 07:02 AM
  2. Replies: 1
    Last Post: 03-23-2014, 11:27 PM
  3. Replies: 1
    Last Post: 10-22-2012, 07:04 PM

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