Results 1 to 2 of 2
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Posts
    254
    Thanks
    0
    Thanked 0 Times in 0 Posts

    global code in the OnOpen event of a report

    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

  2. #2
    Star Lounger
    Join Date
    Apr 2002
    Posts
    58
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: global code in the OnOpen event of a report

    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.

Posting Permissions

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