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

    (Access 2000)

    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

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

    Re: (Access 2000)

    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)
    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
  •