Results 1 to 5 of 5
  1. #1
    Tyork is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    Oct 2010
    Posts
    35

    Filter Report by Time


    I'm trying to filter a report by time which should be easy enough however I'm have an issue with data type mismatches.

    Code is as follows:

    Code:
     
    Dim strWhere As String
    Begin = Format(Me!TimeFrom.Value, "hh:mm:ss")
    Finish = Format(Me!TimeTo.Value, "hh:mm:ss")
    strWhere = "[Deadline4] >='" & Begin & "' AND [Deadline4] <='" & Finish & "' AND [Day] = date()"
    DoCmd.OpenReport "Reports_DateRange", acViewReport, , strWhere
    Deadline 4 is date/time and is entered as the time part only. Any help would be greatly appreciated.

  2. #2
    NTC is offline VIP
    Windows Vista Access 2007
    Join Date
    Nov 2009
    Posts
    2,392
    guesses/distractions: begin & finish not dimmed, Day is reserved word I think, is there the correct "'" around Day= portion of statement??-not sure

    have you considered putting the criteria in the underlying record source query rather than the opening argument? might be easier....

    hope this helps a little.

  3. #3
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    The type mismatch is because in Access, date/time values need to be surrounded by # rather than ' (which is for text values).
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    Tyork is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    Oct 2010
    Posts
    35
    Thanks pbaldy, I appreciate the help.

  5. #5
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    No problemo.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Problems with Report Filter
    By eww in forum Programming
    Replies: 1
    Last Post: 10-20-2010, 02:58 PM
  2. Report Filter Problem
    By Imgsolutions in forum Access
    Replies: 2
    Last Post: 07-07-2010, 02:32 PM
  3. Advanced Report Filter
    By bigdan5428 in forum Reports
    Replies: 1
    Last Post: 05-08-2010, 08:17 PM
  4. filter by form for report
    By stephenaa5 in forum Reports
    Replies: 1
    Last Post: 05-08-2010, 03:14 AM
  5. How to Filter Report
    By mikel in forum Reports
    Replies: 2
    Last Post: 08-28-2009, 10:11 AM

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