Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2005
    Posts
    8

    Unanswered: Filtered Report?

    Hey all, I have been trying to filter my report However It doesnt seem to be working the way I would like it to. I have the ability to filter on my form, so I can search Wood* and then there will be 27 records displayed so I can view each one speratly. however now I would like to have it on a report. I would like to then click the report button, and view those 27 records on my report as the layout that I have provied I can see multiple on a sheet. Any ideas?

  2. #2
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    How did you do it on the form? Do it the same way on your report...
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  3. #3
    Join Date
    Feb 2005
    Posts
    8
    well if I do it the same way then i will only have one record, the first one in the ones that are there say 27 out of 250...Ideas?

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    how have you se the filter on your form?
    how do you call your report?
    if you call the report from the form you could put the criteria as part of the call to the report
    have a look at the help system for the options on opening a report by code. Can't remember if its docmd.openreport but soemwhere in the help it tells you how to set parameters (basically its the same as the where clause in SQL minus the 'where' text

    you may even be able to asign the form filter directly
    I'd rather be riding on the Tiger 800 or the Norton

  5. #5
    Join Date
    Dec 2003
    Location
    Dallas, TX
    Posts
    1,004

    Talking

    Quote Originally Posted by NewfieSarah
    well if I do it the same way then i will only have one record, the first one in the ones that are there say 27 out of 250...Ideas?
    Hey Sarah,

    Here is a way to filter your info. to go to a Report if you are searching for a Date. Check it out:
    Code:
    Private Sub cmdPreviewTheReport_Click()
    On Error GoTo Err_cmdPreviewTheReport_Click
    
        Dim stDocName As String
        Dim stLinkCriteria As String
        
        stDocName = "rptEAFilingReport"
               
        stLinkCriteria = "[ScanDate]>=" & "#" & Me![BeginningDate] & "# AND [ScanDate]<=" & "#" & Me![EndingDate] & "#"
    
        DoCmd.OpenReport stDocName, acViewPreview, , stLinkCriteria
            
        'DoCmd.OpenReport stDocName, acPreview
    
    Exit_cmdPreviewTheReport_Click:
        Exit Sub
    
    Err_cmdPreviewTheReport_Click:
        MsgBox Err.Description
        Resume Exit_cmdPreviewTheReport_Click
        
    End Sub
    Just take a look at it and you will see how it works.

    This is the code behind two Date input boxes on an Unbound form. When you input your dates and click the CommandButton, it then filters for the dates input.

    have a nice one,
    BUD

  6. #6
    Join Date
    Jan 2006
    Location
    Washington, D.C
    Posts
    29
    I found that the report filter attribute dosen't work as well. The besy way to do it is to pass it to the record source. You can do it from the report open function

    sSql = "Select * from TrackingSheet WHERE Name = " & quotedstr("john*")

    Me.RecordSource = sSql

    or call it from a form like so

    Report_reportname.RecordSource = sSq

    If your using strings the following function is very helpful.

    ' used to put quotes around text in SQL
    Public Function quotedStr(ByVal str As String)
    quotedStr = """" & str & """"
    End Function

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •