Results 1 to 4 of 4

Thread: error 3071

  1. #1
    Join Date
    Feb 2012
    Posts
    4

    Unanswered: error 3071

    I have created a query which has the following sql format:

    SELECT tbl_Stage_1.Category, tbl_Stage_1.Condition, tbl_Stage_1.Production_Date, Sum(tbl_Stage_1.Weight_lbs) AS SumOfWeight_lbs
    FROM tbl_Stage_1
    GROUP BY tbl_Stage_1.Category, tbl_Stage_1.Condition, tbl_Stage_1.Production_Date
    HAVING (((tbl_Stage_1.Category)="Accessories") AND ((tbl_Stage_1.Condition)="Premium") AND ((tbl_Stage_1.Production_Date) Between [Start] And [End]))
    ORDER BY tbl_Stage_1.Category DESC , tbl_Stage_1.Condition DESC;



    When I run the query, i get an error 3071: This expression is typed incorrectly.......


    Any suggestions on how I could fix this error?

    I am also new to databases so I request any suggestions or responses be easily understood by a beginner to databases.

    Thanks,

    Kumail

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    I guess that the culprit might be in:
    Code:
    Between [Start] And [End]
    What are [Start] and [End] and where do they come from (there is no table qualifier for these)?

    If they are references to controls on a form, they must appear outside quotes (if the query is assembled in the module of this form):
    Code:
    "... Between " & Me.Start.Value & " ...
    or must be fully qualified:
    Code:
    "... Between Form!FormName![Start] ...
    Moreover and in any case, if they contain Date/Time data, try formatting them:
    Code:
    Between Format([Start], "mm/dd/yyyy") And Format([End], "mm/dd/yyyy")
    Have a nice day!

  3. #3
    Join Date
    Feb 2012
    Posts
    4

    Thanks

    Thanks for the quick response. It helped alot.

  4. #4
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    You're welcome!
    Have a nice day!

Posting Permissions

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