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 (Access 2000)

    Global code

    'I have the following working function:
    Public Function sizing(strReportName As String)
    Dim Gebinde As Control
    Set Gebinde = Forms![FBenchmark]![Gebinde]
    Reports(strReportName).FilterOn = True
    Select Case Gebinde
    Case 1
    sizing = strSmall
    Case 2
    sizing = StrDrums
    Case Else
    sizing = ""
    End Select
    End Function
    'On the OnOpen event of the report i have :
    sizing (Me.Name)

    'I want to improve my code further and to include the control Gebinde also in the
    'brackets but i do not know how.If i include Gebinde as Control i receive error.
    'If i include Gebinde only in the brackets, then i cannot write properly the
    'OnOpen event of sizing (Me.Name).I alwayd receive errors.
    'May i ask for help?

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: global code (Access 2000)

    <hr>include the control Gebinde also in the
    'brackets <hr>
    Do you mean you want to pass the control into the routine as an argument? That should be quite simple.

    Public Function sizing(strReportName As String, _
    ctlGebinde As Control)
    Reports(strReportName).FilterOn = True
    Select Case ctlGebinde.Value
    Case 1
    sizing = strSmall
    Case 2
    sizing = StrDrums
    Case Else
    sizing = ""
    End Select
    End Function

    You would call it from the report like this:

    sizing Me.Name, Forms![FBenchmark]![Gebinde]

    or like this if you're assigning the result to a variable

    strVar = sizing(Me.Name, Forms![FBenchmark]![Gebinde] )
    Charlotte

Posting Permissions

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