Date Query

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jimleon
    New Member
    • Nov 2006
    • 74

    Date Query

    I have a query that selects all records between 2 dates. The follow up date field is stored in text format. I keep receiving a"This expression is typed incorrectly, or it is too complex to be evaluated"

    The offending line is shown thus.

    WHERE ((CDate([follow_up_date])) Between [Start Date] And [End Date]))

    Now the weird thing is it worked last week.... I am confused...
  • Avellano
    New Member
    • Jun 2007
    • 7

    #2
    Originally posted by jimleon
    I have a query that selects all records between 2 dates. The follow up date field is stored in text format. I keep receiving a"This expression is typed incorrectly, or it is too complex to be evaluated"

    The offending line is shown thus.

    WHERE ((CDate([follow_up_date])) Between [Start Date] And [End Date]))

    Now the weird thing is it worked last week.... I am confused...
    I can only assume you have some garbage in one or more records in the follow_up_date field.

    Why not change that field to date format and apply an input mask

    Regards

    Avellano

    Comment

    • jimleon
      New Member
      • Nov 2006
      • 74

      #3
      Yes but the follow up date field is delibrately in text format for a good reason. I run another query on the same field where i compare it to todays date and that works so i'm sure the data is ok. And as I said it did work last week!!!

      Originally posted by Avellano
      I can only assume you have some garbage in one or more records in the follow_up_date field.

      Why not change that field to date format and apply an input mask

      Regards

      Avellano

      Comment

      • MMcCarthy
        Recognized Expert MVP
        • Aug 2006
        • 14387

        #4
        There can be issues with date formats. Impose a format (American or European, whichever you use.

        [CODE=sql]
        WHERE (CDate(Format([follow_up_date], "mm/dd/yyyy")) Between [Start Date] And [End Date]))[/CODE]

        See if that works, if not try format after CDate and see if that works.

        Comment

        Working...