locked
Run-time error '3075' RRS feed

  • Question

  • I am encountering the error '3075'; Syntax error (missing operator) in query expression '2NDLINE'.

    When I run the line:

    MsgBox DLookup("2NDCHECK", "TypeLookUp", "[TypeID] =" & Forms![A Form]!cmbChangeType)

    Is there anything obviously wrong with this syntax? I cant see anything wrong with it.

    Thanks

     


    Nath

    Wednesday, March 8, 2017 8:12 PM

Answers

  • I am encountering the error '3075'; Syntax error (missing operator) in query expression '2NDLINE'.

    When I run the line:

    MsgBox DLookup("2NDCHECK", "TypeLookUp", "[TypeID] =" & Forms![A Form]!cmbChangeType)

    Is there anything obviously wrong with this syntax? I cant see anything wrong with it.

    Because your variable name "2NDCHECK" begins with a non-alphabetic character, you need to surround it with square brackets.  Try this:

        MsgBox DLookup("[2NDCHECK]", "TypeLookUp", "[TypeID] =" & Forms![A Form]!cmbChangeType)


    Dirk Goldgar, MS Access MVP
    Access tips: www.datagnostics.com/tips.html

    • Marked as answer by NaPazz Sunday, March 12, 2017 2:01 PM
    Friday, March 10, 2017 4:34 PM

All replies

  • Is TypeID a Text field? Perhaps you need the following:

    MsgBox DLookup("2NDCHECK", "TypeLookUp", "[TypeID] = '" & Forms![A Form]!cmbChangeType & "'")

    I did add a space as well between the "=" operator and double quote so that may fix it as well without the above change.


    Paul ~~~~ Microsoft MVP (Visual Basic)

    Wednesday, March 8, 2017 8:51 PM
  • Hi NaPazz,

    >>I am encountering the error '3075'; Syntax error (missing operator) in query expression '2NDLINE'.

    According to this error message,I think the error may be caused by query string.I'm wondering what's the

    cmbChangeType's row source.You could check the criteria like this

    Msgbox  "[TypeID] =" & Forms![A Form]!cmbChangeType

    So you could know if the criteria meets your need.

    In order to provide a solution to your issue effectively, I’m wondering if you could provide more details,

    for instance, is TypeLookUp a table name or a query name and show me the table or the query string?

    My Regards

    Terry

    Thursday, March 9, 2017 5:04 AM
  • I am encountering the error '3075'; Syntax error (missing operator) in query expression '2NDLINE'.

    When I run the line:

    MsgBox DLookup("2NDCHECK", "TypeLookUp", "[TypeID] =" & Forms![A Form]!cmbChangeType)

    Is there anything obviously wrong with this syntax? I cant see anything wrong with it.

    Because your variable name "2NDCHECK" begins with a non-alphabetic character, you need to surround it with square brackets.  Try this:

        MsgBox DLookup("[2NDCHECK]", "TypeLookUp", "[TypeID] =" & Forms![A Form]!cmbChangeType)


    Dirk Goldgar, MS Access MVP
    Access tips: www.datagnostics.com/tips.html

    • Marked as answer by NaPazz Sunday, March 12, 2017 2:01 PM
    Friday, March 10, 2017 4:34 PM