• global code (Access 2000)

    Author
    Topic
    #358906

    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?

    Viewing 0 reply threads
    Author
    Replies
    • #536631

      [indent]


      include the control Gebinde also in the
      ‘brackets


      [/indent]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] )

    Viewing 0 reply threads
    Reply To: global code (Access 2000)

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

    Your information: