Results 1 to 4 of 4
  1. #1
    4 Star Lounger
    Join Date
    Jun 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    527
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Another query problem (A2K)

    I am trying something in a query and it is giving me fits. I need to return all records based on a date control on a form. The kicker is that I want to add 10 days to the date in the control. Here is what I have in the criteria for the field in the query:

    <([forms]![frmreportform]![txtenddate]+10)

    This gives me an error that says it is too complex to be evaluated. Does anyone know the correct way to list this one?

    Thanks,
    Mark

  2. #2
    3 Star Lounger
    Join Date
    Mar 2001
    Location
    Minneapolis, Minnesota, USA
    Posts
    262
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Another query problem (A2K)

    Mark:

    Give this a shot: <DateAdd("d",10,[Forms]![frmReportForm].[txtEndDate].[Value])
    <font face="Comic Sans MS"><font color=blue>~Shane</font color=blue></font face=comic>

  3. #3
    Bronze Lounger
    Join Date
    Nov 2001
    Location
    Arlington, Virginia, USA
    Posts
    1,394
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Re: Another query problem (A2K)

    I don't think there's a problem with the query expression itself, it should work OK, however, need to take a look at the "date control" (textbox?) on the form . You need to specifiy a valid date format, such as Short Date, Medium Date, whatever. Testing this, I was able to reproduce "Too complex" error only when the textbox on form did not have a specific date format specified in Format property. When date format specified for textbox, query works OK.

    HTH

  4. #4
    Bronze Lounger
    Join Date
    Nov 2001
    Location
    Arlington, Virginia, USA
    Posts
    1,394
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Re: Another query problem (A2K)

    PS: Another option that will work even if date format NOT specified for control on form. Open Query Parameters dialog (Query menu item) and in "Parameter" column enter [Forms]![frmreportform]![txtenddate]. In "Data Type" column select Date/Time. This will ensure that the form control value referenced in query is evaluated as a date. Of course, to get correct results when query runs the control on form must contain a valid date value.

    HTH

Posting Permissions

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