Results 1 to 2 of 2
  1. #1
    pshakti is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jul 2014
    Posts
    1

    Post Create a Login Form

    Hi,
    I have this code for a login form. While execution, it throws Runtime Error 2185.



    Can someone suggest, changes in the code:

    Private Sub Command1_Click()
    If IsNull(Me.txtLogin) Then
    MsgBox "Please Enter Your CAO Code", vbInformation, "CAO Code Required"
    Me.txtLogin.SetFocus
    ElseIf
    IsNull(Me.txtPassword) Then
    MsgBox "Please Enter Password", vbInformation, "Password Required"
    Me.txtPassword.SetFocus
    Else
    'Process the job
    If (IsNull(DLookup("CAO_Code", "tbl_Login", "CAO_Code='" & Me.txtLogin.Value & "'"))) Or _
    (IsNull(DLookup("Password", "tbl_Login", "Password='" & Me.txtPassword.Text & "'"))) Then
    MsgBox "Incorrect CAO Code or Password"
    Else 'MsgBox "CAO Code or Password Correct"
    DoCmd.OpenForm "Form1"
    End If

    End If


    End Sub

  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,822
    Make this one line:

    ElseIf IsNull(Me.txtPassword) Then

    Don't use .Text, use .Value or since .Value is the default for data controls, just don't type it at all.
    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.

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

Similar Threads

  1. Create Login With 2 Access Levels
    By WickidWe in forum Forms
    Replies: 2
    Last Post: 12-30-2013, 02:38 AM
  2. create form login with pasword
    By thomanmpku in forum Security
    Replies: 2
    Last Post: 08-29-2013, 06:32 PM
  3. Replies: 4
    Last Post: 05-29-2012, 01:32 PM
  4. Having trouble visualizing how to create a login
    By seth.murphine in forum Access
    Replies: 19
    Last Post: 04-11-2012, 03:24 PM
  5. Replies: 1
    Last Post: 12-11-2011, 11:48 AM

Tags for this Thread

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