none
Passing paramter to report in A2000 RRS feed

Answers

  • The DoCmd.OpenReport method has an argument OpenArgs that you can use to pass information to the report. For example:

    DoCmd.OpenReport ReportName:="rptMyReport", View:=acViewPreview, OpenArgs:="Whatever"

    When the report is opened, the value that you specified will be available in the OpenArgs property of the report. You can inspect it in the On Open or On Load event of the report. For example:

    Private Sub Report_Open(Cancel As Integer)
        If Not IsNull(Me.OpenArgs) Then
            MsgBox "You passed " & Me.OpenArgs & " to the report", vbInformation
        End If
    End Sub


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

    Saturday, October 31, 2015 1:32 PM

All replies

  • The DoCmd.OpenReport method has an argument OpenArgs that you can use to pass information to the report. For example:

    DoCmd.OpenReport ReportName:="rptMyReport", View:=acViewPreview, OpenArgs:="Whatever"

    When the report is opened, the value that you specified will be available in the OpenArgs property of the report. You can inspect it in the On Open or On Load event of the report. For example:

    Private Sub Report_Open(Cancel As Integer)
        If Not IsNull(Me.OpenArgs) Then
            MsgBox "You passed " & Me.OpenArgs & " to the report", vbInformation
        End If
    End Sub


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

    Saturday, October 31, 2015 1:32 PM
  • I'm not sure that was available with A2000.

    Alternatives include:

    1. The report could "look back" on a form to get the value (e.g. lngCustomerID = Forms!frmOrders!CustomerID)
    2. We could use a global variable.


    -Tom. Microsoft Access MVP

    Saturday, October 31, 2015 3:44 PM
  • I'm not sure that was available with A2000.

    Alternatives include:

    1. The report could "look back" on a form to get the value (e.g. lngCustomerID = Forms!frmOrders!CustomerID)
    2. We could use a global variable.


    -Tom. Microsoft Access MVP

    You are correct Tom, that option was not available in 2000.  Your suggestions are on target.

    Below is a link which Hans, among others, offers tips to a 2000 user in more detail.

    http://windowssecrets.com/forums/showthread.php/39216-OpenArgs-for-a-Report-(Access-2000)

    Saturday, October 31, 2015 4:09 PM
  • Thanks for the correction and the link!

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

    Saturday, October 31, 2015 4:21 PM