Adding fiilters in reports.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • neosam
    New Member
    • Mar 2008
    • 47

    Adding fiilters in reports.

    Hi,

    This is wierd.... I had given filters to a report and when a cmd button is clicked, the filtered report (Data having a particular date) is opened. This worked fine yesterday. but today it is not filtering the data in the report... Could someone tell me i have edited the coding by mistake?

    Code:
    DoCmd.OpenReport "ReportName", acViewPreview, , "Date >= From_Date" & "< To_Date"
  • JKing
    Recognized Expert Top Contributor
    • Jun 2007
    • 1206

    #2
    Originally posted by neosam
    Hi,

    This is wierd.... I had given filters to a report and when a cmd button is clicked, the filtered report (Data having a particular date) is opened. This worked fine yesterday. but today it is not filtering the data in the report... Could someone tell me i have edited the coding by mistake?

    Code:
    DoCmd.OpenReport "ReportName", acViewPreview, , "Date >= From_Date" & "< To_Date"
    I think your where criteria is malformed.

    You either want:
    Code:
    DoCmd.OpenReport "ReportName", acViewPreview, , "Date >= From_Date AND Date <= To_Date"
    
    'or alternatively if you are referencing controls on a form
    
    DoCmd.OpenReport "ReportName", acViewPreview, , "Date >= #" & Me.From_Date & "# AND Date <= #" & Me.To_Date & "#"

    Comment

    • neosam
      New Member
      • Mar 2008
      • 47

      #3
      Originally posted by JKing
      I think your where criteria is malformed.

      You either want:
      Code:
      DoCmd.OpenReport "ReportName", acViewPreview, , "Date >= From_Date AND Date <= To_Date"
      
      'or alternatively if you are referencing controls on a form
      
      DoCmd.OpenReport "ReportName", acViewPreview, , "Date >= #" & Me.From_Date & "# AND Date <= #" & Me.To_Date & "#"
      Dude,

      You are a life saver......

      Comment

      • JKing
        Recognized Expert Top Contributor
        • Jun 2007
        • 1206

        #4
        Originally posted by neosam
        Dude,

        You are a life saver......
        Haha,

        You're welcome :)

        Jared

        Comment

        Working...