none
Found great Allen Browne Search Criteria Form - now how can I use the Results to print reports RRS feed

  • Question

  • Hi

    I found a great search Form designed by Allen Browne in 2006. (http://www.everythingaccess.com/tutorials.asp?ID=Build-a-search-criteria-form)

    I modified it a little to my needs. And that is to search on part of a beer name and get the BrewNo and full name. Next step is to print reports on the results of a search

    In this case there is 14 brews between 1 of August and 6 of October. Every brew got its unique brewNo (BryggNr). Now I want to print reports on this 14 BryggNr. But I cant find  how to take the search results from Form to Reports.

    Any tips?


    Best // Peter Forss Stockholm and Sigtuna GMT +1.00

    Tuesday, October 6, 2015 1:34 PM

Answers

  • Create a report rptBrewFilter with the same record source as the form.

    Place a command button cmdReport on the form with an On Click event procedure like this:

    Private Sub cmdReport_Click()
        On Error GoTo ErrHandler
        DoCmd.OpenReport ReportName:="rptBrewFilter", View:=acViewPreview, WhereCondition:=Me.Filter
        Exit Sub
    ErrHandler:
        If Err = 2501 Then
            ' Report was canceled - ignore this error
        Else
            MsgBox Err.Description, vbExclamation
        End If
    End Sub


    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    Tuesday, October 6, 2015 2:24 PM

All replies

  • Create a report rptBrewFilter with the same record source as the form.

    Place a command button cmdReport on the form with an On Click event procedure like this:

    Private Sub cmdReport_Click()
        On Error GoTo ErrHandler
        DoCmd.OpenReport ReportName:="rptBrewFilter", View:=acViewPreview, WhereCondition:=Me.Filter
        Exit Sub
    ErrHandler:
        If Err = 2501 Then
            ' Report was canceled - ignore this error
        Else
            MsgBox Err.Description, vbExclamation
        End If
    End Sub


    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    Tuesday, October 6, 2015 2:24 PM
  • Great help!

    Thanks a lot Hans.


    Best // Peter Forss Stockholm and Sigtuna GMT +1.00

    Tuesday, October 6, 2015 2:34 PM