Results 1 to 4 of 4

Thread: Date <=

  1. #1
    2 Star Lounger
    Join Date
    Jan 2004
    Posts
    196
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Date <=

    I import data from a .CSV file. The date field in the CSV file is "YYYYMMDD". I have a query that converts that to a short date with,InvDate: DateSerial(Left([DateTxt],4),Mid([DateTxt],5,2),Right([DateTxt],2)). I am now querying that query and wanting only records that are older than 10 days from now.

    Currently i have:
    myDate: DateDiff("d",[InvDate],Date())>10

    I get a data type mismatch.

    Need some help getting this to work.

    thanks...

  2. #2
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,436
    Thanks
    372
    Thanked 1,457 Times in 1,326 Posts
    Jackal,

    If I read your code right the calculated field myDate is going to have a value of True or False. How are you selecting the records to be printed in the Criteria row of the query? HTH
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

  3. #3
    2 Star Lounger
    Join Date
    Jan 2004
    Posts
    196
    Thanks
    1
    Thanked 0 Times in 0 Posts
    That explains the results i get when i run the query. What expression or criteria can i use to get only the records that are older than 10 days from now?

    currently I do not have anything in the criteria row.

  4. #4
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,436
    Thanks
    372
    Thanked 1,457 Times in 1,326 Posts
    Jackal,

    So what you need in the Criteria Row is True.

    Here's an example:
    DateDiff Query Design.JPG

    This will show Deceased dates older than 2 years.
    DateDiff Query Results1.JPG

    Change the Criteria to True and you get Deceased dates less than 2 years old.
    DateDiff Query Results2.JPG
    HTH
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

Posting Permissions

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