Results 1 to 6 of 6
  1. #1
    radstl is offline Novice
    Windows Vista Access 2010 64bit
    Join Date
    Oct 2015
    Posts
    4

    "This expression is typed incorrectly, or it is too complex..." Error with Date criteria

    Hi all,



    I have a query that returns expenses from a table and summarizes them by direct costs and indirect costs.

    I use an unbound form to specify the criteria, which in this case is the date range for which the expense should fall within.

    My problem is some date ranges work fine and other times, I receive this error: "This Expression is typed incorrectly, or it is too complex...". For example a date range of 7/1/15 to 9/30/15 works, but 4/1/15 to 6/30/15 does not. Can anyone help? SQL below. Thanks in advance - Ryan.

    SELECT qryexpense.expenseaccount, Sum(IIf([expensecode]<>"9740",[expenseamount],0)) AS directcosts, Sum(IIf([expensecode]="9740",[expamount],0)) AS indirectcosts, Sum(qryexpense.expenseamount) AS totalcosts
    FROM qryexpense
    WHERE ((qryexpense.expensedate)>=[Forms]![frmcosts]![start] And (qryexpense.expensedate)<=[Forms]![frmcosts]![end]))
    GROUP BY qryexpense.expenseaccount;

  2. #2
    InsuranceGuy is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Aug 2015
    Location
    Colorado
    Posts
    126
    Check for null data values in your 4/1/15 to 6/30/15 date range. Also a common problem is using 6/31/15, which is an invalid date.

  3. #3
    radstl is offline Novice
    Windows Vista Access 2010 64bit
    Join Date
    Oct 2015
    Posts
    4
    Hi Insurance Guy. I checked, and there are no null values in the fields being pulled in the query. Thanks for the suggestion.

  4. #4
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    You also might try setting the text boxes "Format" property to "Short Date" and/or set the "Input mask" property to "99/99/0000;0;_".


    BTW, "Start" and "End" are reserved words in Access; these are poor words to use as object names. (not descriptive.... Start of what??)
    "StartDate" and "EndDate" would be better.

    List of reserved words:
    http://www.allenbrowne.com/AppIssueBadWord.html

  5. #5
    radstl is offline Novice
    Windows Vista Access 2010 64bit
    Join Date
    Oct 2015
    Posts
    4
    The names of the fields are actually frmdcidcstartdate and frmdcidcenddate but for the sake of simplicity, I shortened them in my post above

    I try your suggestion. Thanks ssanfu.

  6. #6
    radstl is offline Novice
    Windows Vista Access 2010 64bit
    Join Date
    Oct 2015
    Posts
    4
    The input mask worked, great suggestion! Thanks ssanfu.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 10-03-2012, 12:41 PM
  2. Replies: 2
    Last Post: 06-07-2012, 02:59 PM
  3. Replies: 1
    Last Post: 05-24-2012, 12:34 PM
  4. Replies: 3
    Last Post: 12-30-2011, 12:43 PM
  5. Replies: 3
    Last Post: 03-31-2011, 11:07 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums