• global code in the OnOpen event of a report

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » global code in the OnOpen event of a report

    Author
    Topic
    #351974

    global code in the OnOpen event of a report

    i have the following code in the OnOpen event of an report that works fine:
    Private Function OfficeFilter(office)
    If office = 1 Then
    Me.FilterOn = True
    Me.Filter = strLondon
    End If
    End Function
    i want however to replace the Me and build a global public function that should
    be valid for all the other reports without mentioning their name.
    is it possible to use a global function in the OnOpen event of a report ?
    just to mention that office is a control on any form in the database,
    and strLondon is a constant.
    I have somewhere a grave mistake but i cannot find it where

    I will be grateful for any help

    Viewing 0 reply threads
    Author
    Replies
    • #510770

      I would think if you simply modify the function as follows:

      Private Function OfficeFilter(office, strReportName as String)
      If office = 1 Then
      Reports(strReportName).FilterOn = True
      Reports(strReportName).Filter = strLondon
      End If
      End Function

      Then, in the OnOpen Event of each report, put in the code of:

      OfficeFilter(Office, Me.Name)

      Good luck.

    Viewing 0 reply threads
    Reply To: global code in the OnOpen event of a report

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: