Results 1 to 6 of 6
  1. #1
    nicorvp is offline Novice
    Windows XP Access 2003
    Join Date
    May 2010
    Posts
    3

    Selecting between two dates

    I have to select tasks from MSProject file (.mdb exported) that recurs in a given date: I could use:
    Code:
    ... WHERE MyDate>=TASK_START_DATE AND  MyDate<=TASK_FINISH_DATE
    But suppose I have a record in which:
    TASK_START_DATE 21/01/2010 8.00.00
    TASK_FINISH_DATE 25/01/2010 8.00.00
    Quering with MyDate = 21/01/2010, I cant get this record because Access supposes that MyDate is 21/01/2010 0.00.00 that is before 8 o'clock.


    I have tried rebuilding dates with DatePart, trying to remove the time part of the date, but without success
    Can you help me?

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Try:
    WHERE MyDate>=TASK_START_DATE AND MyDate<=TASK_FINISH_DATE+1

  3. #3
    nicorvp is offline Novice
    Windows XP Access 2003
    Join Date
    May 2010
    Posts
    3
    I think it doesnt work for me.
    If I use this it would be:

    WHERE 21/04/2010 0.00.00>=21/01/2010 8.00.00
    AND 21/04/2010 0.00.00<=26/01/2010 8.00.00

    that is false!

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I'm sorry but I misread your post. How about using DateValue?
    WHERE DateValue("21/04/2010 0.00.00")>=DateValue([TASK_START_DATE])
    AND DateValue("21/04/2010 0.00.00")<=DateValue([TASK_FINISH_DATE])

  5. #5
    nicorvp is offline Novice
    Windows XP Access 2003
    Join Date
    May 2010
    Posts
    3
    That's it!!!
    Many thanks

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    You're welcome. Are you ready to follow the link in my sig and mark this thread as Solved?

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

Similar Threads

  1. Selecting next set of control No's
    By newtoAccess in forum Queries
    Replies: 0
    Last Post: 02-28-2010, 10:28 AM
  2. Selecting random with exclutions
    By owutne in forum Queries
    Replies: 1
    Last Post: 02-03-2010, 09:33 PM
  3. Selecting Just One Name Type
    By susan in forum Queries
    Replies: 1
    Last Post: 12-03-2009, 12:08 PM
  4. Selecting text - ComboBox
    By Numbat in forum Programming
    Replies: 2
    Last Post: 06-05-2006, 05:42 PM
  5. Replies: 1
    Last Post: 03-17-2006, 12:04 PM

Tags for this Thread

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