Results 1 to 3 of 3
  1. #1
    WickidWe is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2013
    Posts
    123

    Query "WHERE" between two dates.

    I have the following Query that excludes the person with the date on a leave table with the selected date in a form.
    this query is working, but I would like to change the query to look between two dates in the leave table
    "Date_" and "EndDate" but It is not showing the results I was hoping to get.

    this is working fine :
    Code:
    SELECT TE.Name, TE.EmpId
    FROM tblEmpDetails AS TE
    WHERE (((TE.EmpId) Not In (SELECT TL.EmpID
         FROM tblEmpLeave AS TL
         WHERE TL.Date_ =[Forms]![Form1]![txtDate])))
    ORDER BY TE.Name;
    I tried the following but it is not giving me the results I need"


    Code:
    SELECT TE.Name, TE.EmpId
    FROM tblEmpDetails AS TE
    WHERE (((TE.EmpId) Not In (SELECT TL.EmpID
         FROM tblEmpLeave AS TL
         WHERE TL.Date_ >=[Forms]![Form1]![txtDate] And TL.EndDate <=[Forms]![Form1]![txtDate])))
    ORDER BY TE.Name;

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Maybe:

    WHERE [Forms]![Form1]![txtDate] BETWEEN TL.Date_ AND TL.EndDate

    Edit the SQL statement in SQL View then switch to DesignView.

    Date structure issues discussed in your other thread apply here.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    WickidWe is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2013
    Posts
    123
    That Was the Ticket!
    Thank you

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

Similar Threads

  1. Replies: 1
    Last Post: 12-16-2013, 03:22 AM
  2. Replies: 2
    Last Post: 11-14-2012, 04:47 PM
  3. Export "Query or Report" to a "Delimited Text File"
    By hawzmolly in forum Import/Export Data
    Replies: 3
    Last Post: 08-31-2012, 08:00 AM
  4. Replies: 1
    Last Post: 08-23-2012, 08:32 AM
  5. simple "between dates" query
    By mejia.j88 in forum Queries
    Replies: 4
    Last Post: 02-06-2012, 06:22 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