Results 1 to 11 of 11
  1. #1
    Join Date
    Nov 2005
    Posts
    8

    Angry Unanswered: Runtime error 3141

    I get the runtime error 3141 which says the SELECT statement includes a reserved word or an argument name that is misspelled or missing, or the punctuation is incorrect.

    The code is as below:
    Set recset1 = db.OpenRecordset(" SELECT Property.Status, Property.StarShare, " & _
    " [Medical Future Contribution and Rates Query].SAP, Property.PropertyName, " & _
    " [Medical Future Contribution and Rates Query].PlanName, [Medical Future Contribution and Rates Query].PlanCode, " & _
    " [Medical Future Contribution and Rates Query].EEE0, [Medical Future Contribution and Rates Query].EEE1, " & _
    " [Medical Future Contribution and Rates Query].EEE2, [Medical Future Contribution and Rates Query].EEE3, " & _
    " [Medical Future Contribution and Rates Query].TTE0, [Medical Future Contribution and Rates Query].TTE1, " & _
    " [Medical Future Contribution and Rates Query].TTE2, [Medical Future Contribution and Rates Query].TTE3, " & _
    " FROM Property RIGHT JOIN [Medical Future Contribution and Rates Query] ON Property.SAP = " & _
    " [Medical Future Contribution and Rates Query].SAP;", dbOpenDynaset)

    Can someone please help me?

    Thanks in advance!!!

  2. #2
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    YEEEOOOWWW!!

    1) Don't use spaces in table names
    2) Don't duplicate information in the same table. It looks like you may have done this with TTE0, TTE1, TTE2 & TTE3
    3) Property is well... a property declaration. Access probably doesn't like that. I would strongly advise against using Property as a table name, tblProperty perhaps. If you're dead set on using it, enclose it in brackets like you have the other table.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  3. #3
    Join Date
    Nov 2005
    Posts
    8
    Thanks for getting back to me. It seems there is something wrong with the last line but I can't figure it out.

    I applied your suggestions and still doesn't seem to work.

    Let me know if you have any other.

    Thanks!!

  4. #4
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Try running the query as just a query. Forget the VBA, make it work in a query through SQL view.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  5. #5
    Join Date
    Nov 2005
    Posts
    8
    It works just as a query. But it still doesn't work this way.

  6. #6
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    It works without bracketing "Property"?
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  7. #7
    Join Date
    Nov 2005
    Posts
    8
    yes it does. I had this in an old database (A97) and it worked fine. Now, when I brought it over to this database(A2K) it started giving me this error.

  8. #8
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Sounds fishy. From the access help file:

    Property
    The Property keyword is used in these contexts:

    Property Get Statement

    Property Let Statement

    Property Set Statement
    See where it says it's a "keyword"? That's making me suspicious of whether that query worked without bracketing...
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  9. #9
    Join Date
    Nov 2005
    Posts
    8
    Even if i put a bracket around property it gives me the same error

  10. #10
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    You also have an extra comma just before your FROM clause.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  11. #11
    Join Date
    Nov 2005
    Posts
    8
    Thanks !! getting rid of the extra comma did the trick!!!

Posting Permissions

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