Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2007
    Posts
    74

    Unanswered: Open Recordset Syntax error

    I am creating a form for my helpdesk users that will allow them to pull custom reports. I am using Pootle Flump's code to export the data to a report in excel.

    I am getting a syntax error (Missing Operator) with the following code.

    Note: "strProject" is selected by the user on the form and is passed to the sub when it is called.


    Code:
     
    Set rs = db.OpenRecordset("SELECT Project, ONAME, RCN, ANAME, AID, AID, TA, SYSTEM, STATE, ISSTYPE, STATUS, BTN, " _
    & "DESC, COMMENT, ROC, ROCDESC, ROCSTAT, RESTIME " _
    & "FROM Issues " _
    & "WHERE(Project = " & strProject & ")")
    I cannot seem to locate the issue...

    Please help if you can spot the error, I am sure it is simple...

  2. #2
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Try replacing the WHERE line with this:

    & "WHERE(Project = '" & strProject & "')")

    strProject is a string (implied by the "str" part) so it's contents would need to be in quotes. This will work as long as there are no quotes inside the strProject.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  3. #3
    Join Date
    Jun 2007
    Posts
    74

    Thumbs up Well....

    Thank you.. I could have sworn I tried that but I obviously didn't... Thanks again for your help!

  4. #4
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    You're most welcome
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

Posting Permissions

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