Results 1 to 3 of 3
  1. #1
    sunny is offline Novice
    Windows XP Access 2003
    Join Date
    Jul 2010
    Posts
    15

    Query for date range from two column?

    hi all,
    In one table there is two column for date like start and end date.I wanted to find all the record between start and end date based on the condition.I have written one query but it not working.Below is my query

    SELECT A.STUDY_COMPOUND, A.PROTOCOL, A.TEST_SYSTEM, A.PROTOCOL_TITLE, A.GLP_NONGLP, A.TEST_SITE, A.MASTER_TEST_FACILITY, A.WORK_FACILITY, A.MONITOR_INVESTIGATOR, A.SUPPORT_WORK_ID, A.ACTIVITY, A.WR_DISPLAY, A.WC_DISPLAY, A.WORK_STATUS, A.STUDY_DIRECTOR, A.DATE_INITIATED, A.DATE_COMPLETE, A.IN_VIVO_START, A.IN_VIVO_END, A.STUDY_STATUS, A.COMMENTS
    FROM SMART_STUDY_INFO AS A
    WHERE A.WR_DISPLAY_DT<=#06/27/1997# AND A.WC_DISPLAY_DT <=#08/07/1998#;


    Please try to find what is the error .

    Thanks

  2. #2
    Datagopherdan is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Dec 2008
    Posts
    220
    Are you sure that they are both date data types? Also, I would recommend using "Between" instead of <= e.g.

    A.WR_DISPLAY_DT Between #06/27/1997# AND A.WC_DISPLAY_DT <=#08/07/1998#;

    Quote Originally Posted by sunny View Post
    hi all,
    In one table there is two column for date like start and end date.I wanted to find all the record between start and end date based on the condition.I have written one query but it not working.Below is my query



    Please try to find what is the error .

    Thanks

  3. #3
    NTC is offline VIP
    Windows Vista Access 2007
    Join Date
    Nov 2009
    Posts
    2,392
    you state a Start date and an End date ; but your sql statement is:
    WHERE A.WR_DISPLAY_DT<=#06/27/1997# AND A.WC_DISPLAY_DT <=#08/07/1998#;

    those are both <

    the Start Date would be >= while the End date would be <=

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

Similar Threads

  1. Define a date range for a report - Help
    By Optimus_1 in forum Access
    Replies: 4
    Last Post: 06-02-2010, 04:50 AM
  2. Replies: 1
    Last Post: 04-15-2010, 02:07 AM
  3. Sum of Values over date range
    By bosnian in forum Queries
    Replies: 1
    Last Post: 01-12-2010, 03:41 PM
  4. Count Dates within Date Range
    By eckert1961 in forum Queries
    Replies: 2
    Last Post: 03-08-2009, 10:58 AM
  5. Search form with a date range
    By mantro174 in forum Forms
    Replies: 1
    Last Post: 02-11-2009, 10:45 PM

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