• (Access 2000)

    Author
    Topic
    #358264

    How do i substitue Me in a global code ?

    I want to substitue the Me in the following code so that i can open it from any form.
    My function should work with any form having a control called ProductChoice
    but i do not know how could i replace the Me.
    The function is the following

    Public Function dummy(ProductChoice)
    Dim strDocName As String
    strDocName = “FProducts”
    If IsOpen(strDocName) = True Then
    Select Case ProductChoice
    Case 1
    Me.FilterOn = False
    Case 2
    Me.FilterOn = True
    Me.Filter = “supplierid = 1”
    Case 3
    Me.FilterOn = True
    Me.Filter = “supplierid = 2”
    End Select
    End If
    End Function
    I will be grateful for any advice

    Viewing 0 reply threads
    Author
    Replies
    • #534197

      Here’s how you do it:

      Public Function dummy(frm As Form, ProductChoice)
      Dim strDocName As String
      strDocName = “FProducts”
      If IsOpen(strDocName) = True Then
      Select Case ProductChoice
      Case 1
      frm.FilterOn = False
      Case 2
      frm.FilterOn = True
      frm.Filter = “supplierid = 1”
      Case 3
      frm.FilterOn = True
      frm.Filter = “supplierid = 2”
      End Select
      End If
      End Function

      When you call this routine from a form, you do it like this:

      Result = dummy(Me, ProductChoice)

    Viewing 0 reply threads
    Reply To: (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: