Results 1 to 7 of 7
  1. #1
    Join Date
    Mar 2004
    Location
    California
    Posts
    502

    Unanswered: Parameter Query Date to Complex

    I have 10 fields in a table.

    One of them being a D/M/Y date field [Dte]

    In query design view I've placed [Enter a date range.]

    When I run the query I've tried all of the following which have failed.

    >=#2/1/2007# AND <=#2/28/2007#
    ">=#2/1/2007# AND <=#2/28/2007#"
    Like 2/?/2007
    Between #2/1/2007# AND #2/28/2007#
    Between "#2/1/2007# AND #2/28/2007#"

    Error msg is "expression to complex or complicated . . . "

    I'm stumped!

    Any suggestions?

    Thanks . . . Rick

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Errr, Why not replace
    [Enter a date range.]
    with
    [Enter Lower Date]
    and
    [Enter Upper Date]
    Not the most elegant solution but it'd work.
    George
    Home | Blog

  3. #3
    Join Date
    Mar 2004
    Location
    California
    Posts
    502

    Failed smae error

    Georgev - I tried that combination and a few variations of that which all produced the same error.

    I can't believe there isn't anything about this in the help files that provide a simple solution.

    Rats!

    Thanks . . . Rick

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    you might want to show us the actual query, yes?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  5. #5
    Join Date
    Mar 2004
    Location
    California
    Posts
    502

    Solution!

    This worked pefectly in the datefield critieria section.

    Between [Enter Start Date] And [Enter End Date]

    You can enter the dates as
    3/1/2007
    3/31/2007

    No brackes or quotes or # are required.

    Take heed if you have a similar problems.

    Thanks everyone.

    Rick

  6. #6
    Join Date
    Sep 2004
    Location
    Tampa, FL
    Posts
    520
    Quote Originally Posted by Rick Schreiber
    This worked pefectly in the datefield critieria section.

    Between [Enter Start Date] And [Enter End Date]

    You can enter the dates as
    3/1/2007
    3/31/2007

    No brackets or quotes or # are required.

    Take heed if you have a similar problems.

    Thanks everyone.

    Rick
    As an FYI when you put [enter date range] in the statement it's SQL was reading: (assuming the query was produced in Design View.)
    Code:
    WHERE (((table.field)=[enter date range]));
    so if you put >1/1/1993 the query runs as
    Code:
    WHERE (((table.field)=>1/1/1993));
    There will be an error.
    Last edited by Darasen; 03-27-07 at 00:36.
    Darasen

  7. #7
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    So I believe that means my solution was the right one...
    1-0!
    George
    Home | Blog

Posting Permissions

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