Results 1 to 6 of 6
  1. #1
    GWBMan is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2014
    Posts
    3

    Cool Query Showing No Activity By Date Range

    I have this query that pulls in all data that have no activity. However, I want to pull data that have no activity for a specified date range. Help please!



    This gives me all records with no activity:

    SELECT tblDriver.FirstName, tblDriver.LastName, tblReceiptHistory.ReceiptNumber
    From tblDriver LEFT JOIN tblReceiptHistory
    ON tblDriver.DriversLicense = tblReceiptHistory.DriversLicense
    WHERE tblReceiptHistory.DriversLicense Is Null;

    I would like to pull Null records from tblReceiptHistory for a specified date range.

    I tried this but it returned no data:


    SELECT tblDriver.FirstName, tblDriver.LastName, tblReceiptHistory.ReceiptNumber, tblReceiptHistory.ReceiptDate
    FROM tblDriver LEFT JOIN tblReceiptHistory ON tblDriver.DriversLicense = tblReceiptHistory.DriversLicense
    WHERE (((tblReceiptHistory.ReceiptDate) Between [ENTER 1st DATE] And [ENTER 2nd DATE]) AND;((tblReceiptHistory.DriversLicense) Is Null))

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    Move the ; after AND to end of query. Did the query really save with that?
    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
    GWBMan is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2014
    Posts
    3
    Sorry, typo. This what I actually have that returns no record:

    SELECT tblDriver.FirstName, tblDriver.LastName, tblReceiptHistory.ReceiptNumber, tblReceiptHistory.ReceiptDate
    FROM tblDriver LEFT JOIN tblReceiptHistory ON tblDriver.DriversLicense = tblReceiptHistory.DriversLicense
    WHERE (((tblReceiptHistory.DriversLicense) Is Null) AND ((tblReceiptHistory.ReceiptDate) Between [ENTER 1st DATE] And [ENTER 2nd DATE]));

  4. #4
    recyan's Avatar
    recyan is offline Expert
    Windows 2K Access 2000
    Join Date
    Dec 2011
    Posts
    662
    Check if below works :

    Between DateValue([ENTER 1st DATE]) And DateValue([ENTER 2nd DATE])

    Thanks



  5. #5
    GWBMan is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2014
    Posts
    3
    That still pulled no records

    This is what I have now:

    SELECT tblDriver.FirstName, tblDriver.LastName, tblReceiptHistory.ReceiptNumber, tblReceiptHistory.ReceiptDate
    FROM tblDriver LEFT JOIN tblReceiptHistory ON tblDriver.DriversLicense = tblReceiptHistory.DriversLicense
    WHERE (((tblReceiptHistory.DriversLicense) Is Null) AND ((tblReceiptHistory.ReceiptDate) Between DateValue([ENTER 1st DATE]) And DateValue([ENTER 2nd DATE])));

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    Don't see anything wrong with the syntax so problem must be with data. Would have to review. If you want to provide db, follow instructions at bottom of my post.
    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.

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

Similar Threads

  1. Query for date range
    By BRZ-Ryan in forum Queries
    Replies: 23
    Last Post: 02-05-2014, 09:08 PM
  2. Date Range Query
    By need_help12 in forum Queries
    Replies: 7
    Last Post: 04-25-2012, 01:38 PM
  3. Query Showing No Activity
    By tabbycat1234 in forum Queries
    Replies: 9
    Last Post: 12-06-2011, 06:09 AM
  4. Run query by date range
    By ARickert in forum Access
    Replies: 2
    Last Post: 06-23-2011, 10:54 AM
  5. Replies: 3
    Last Post: 09-29-2009, 07:08 AM

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