Results 1 to 5 of 5
  1. #1
    goodguy is offline Competent Performer
    Windows Vista Access 2007
    Join Date
    Dec 2010
    Location
    Zanzibar, Tanzania
    Posts
    229

    Date Range Failure

    I have a ReportFilter form with this code in the button:
    Code:
    DoCmd.OpenReport "JobsReport", acViewPreview, , "outTime>=#" & (StartDate) & "# and outTime<= #" & (EndDate) & "#"
    It works OK, except that the report excludes the current day's records. Or, possibly, I should say, the last day's records. I've tried tweaking the '<' and '>' with '=' and '+1' etc to no avail.
    What could be wrong?

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    All DateTime fields have a Time component. If you just use the Date then the Time is set to 0 or midnight at the beginning of the day. In this case I usually just add another day to the EndDate.

  3. #3
    goodguy is offline Competent Performer
    Windows Vista Access 2007
    Join Date
    Dec 2010
    Location
    Zanzibar, Tanzania
    Posts
    229
    As I said, I have tried '<+1' and '>+1' in vain.

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Between is inclusive. Give it a try:
    Code:
    DoCmd.OpenReport "JobsReport", acViewPreview, , "[outTime] Between #" & (StartDate) & "# AND #" & (EndDate) & "#"

  5. #5
    goodguy is offline Competent Performer
    Windows Vista Access 2007
    Join Date
    Dec 2010
    Location
    Zanzibar, Tanzania
    Posts
    229
    Will do, thanks.

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

Similar Threads

  1. Date range help!!
    By bananatodd in forum Access
    Replies: 26
    Last Post: 10-18-2010, 01:57 PM
  2. Query for date range from two column?
    By sunny in forum Queries
    Replies: 2
    Last Post: 07-28-2010, 07:12 AM
  3. Define a date range for a report - Help
    By Optimus_1 in forum Access
    Replies: 4
    Last Post: 06-02-2010, 04:50 AM
  4. Sum of Values over date range
    By bosnian in forum Queries
    Replies: 1
    Last Post: 01-12-2010, 03:41 PM
  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