Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2003
    Location
    SLC, UT
    Posts
    11

    Unanswered: Error 3075 - Missing Operator

    Here is my code
    Code:
    Dim intMasterProjectID, intContractorListID As Integer
        Dim strSQL, strContractor As String
        Dim dbs As Database
        Dim rs As dao.Recordset
        
        intMasterProjectID = Forms![Bid - Master Form]![Master Project ID]
        strContractor = Forms![Bid - Master Form]![Bid - Bid Follow Up]![FollowupContractor]
        strSQL = "SELECT * FROM [Bid - Contractor List]" & _
                "WHERE [Bid - Contractor List].[Contractor] = " & strContractor & _
                " AND [Bid - Contractor List].[Master Project ID] = " & intMasterProjectID
                
        Debug.Print "Project ID: " & intMasterProjectID
        Debug.Print "Contractor: " & strContractor
        Debug.Print "SQL: " & strSQL
        Set dbs = CurrentDb
        Set rs = dbs.OpenRecordset(strSQL)
    I get error 3075 in my strSQL statement (syntax error (missing operator) in query expression...). Any Ideas?

    Here is my SQL statement from my immediate window:
    Code:
    SQL: SELECT * FROM [Bid - Contractor List]WHERE [Bid - Contractor List].[Contractor] = Bud Bailey Construction AND [Bid - Contractor List].[Master Project ID] = -8585313
    Thanks

  2. #2
    Join Date
    Oct 2003
    Location
    SLC, UT
    Posts
    11

    Solution

    Here is what it required:
    Code:
    strSQL = "SELECT * FROM [Bid - Contractor List] " & _
                "WHERE [Master Project ID] = " & intMasterProjectID & _
                "AND [Contractor] = '" & strContractor & "'"
    Because strContractor is a string variable, I need to set it off with single quotation marks in my SQL statement.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •