Run-time error 3075 syntax error (missing operator) in query expression when serching

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pptechs
    New Member
    • Sep 2014
    • 1

    Run-time error 3075 syntax error (missing operator) in query expression when serching

    Hello. In dying need of assistance. All I am trying to do is search a table for a valid user ID for a form login screen and I am getting error :

    "Run-time error 3075 syntax error (missing operator) in query expression "

    I get it {on line #8} when using this code. Here is my subroutine and this is MS Access
    Code:
    Private Sub Command84_Click()
        If IsNull(Me.Text85) Then
            MsgBox "Please enter LoginID", vbInformation, "Valid Login ID Required"
            Me.Text85.SetFocus
        Else
            'Process the search for Valid user ID
            'RIGHT HERE IS WHERE I GET THE SYNTAX ERROR AT THIS IF 'STATEMENT BEFORE THE MESSAGE BOX
            If (IsNull(DLookup("User Login ID", "tblUser Account Control", "User Login ID='" & Me.Text85.Value & "'"))) Then
                MsgBox "Incorrect Login ID"
            Else
                DoCmd.Close
                DoCmd.OpenForm "Form_VKEY PWD"
            End If
        End If
    End Sub
    Last edited by NeoPa; Sep 7 '14, 09:34 PM. Reason: Added mandatory [CODE] tags and a reference to the failing line #.
  • GKJR
    New Member
    • Jan 2014
    • 108

    #2
    Try putting the field name in braces like "[User Login ID]", and/or I think you need to remove the quotes that surround Me.Text85.Value since this value is a number and not a string.

    Comment

    • NeoPa
      Recognized Expert Moderator MVP
      • Oct 2006
      • 32653

      #3
      Absolutely right to surround the reference to User Login ID with brackets ([]), but I suspect the value probably is actually a string, so no change on the quotes.

      Comment

      Working...