Results 1 to 2 of 2
  1. #1
    Join Date
    May 2010
    Posts
    23

    Unanswered: "Member Already Exists" Error when calling a public sub within a form

    I created a few Public Subs within a form earlier.
    I call them at the OnCurrent event in a tab control.

    I keep getting the following error whenever I change tabs... but when I remove the Call [sub] code, the error disappears.

    Error:
    "Member already exists in an object module from which this object module derives"
    Code:
    Code:
    Public Sub Pending()
    
        'Set filter for Show All Pending button
        Dim strPending As String
        Dim strVCy As String
        Dim strVCn As String
    
        strVCy = "[VendorContact] = Yes AND " 'Vendor contact not made
        strVCn = "[VendorContact] = No AND "  'Vendor contact true
    
        strPending = "[MSNum] Is Null AND " _
                & "[VisibilityFlag] = Yes"
    
        'Radio button sets vendor contact status
        If Me.opVC = 1 Then
            strPending = strVCy & strPending
        Else
            strPending = strVCn & strPending
        End If
    
    
        Me!subOrderDS0.Form.Filter = strPending
        Me!subOrderDS0.Form.FilterOn = True
    
    End Sub
    
    Public Sub Approvals()
    
        Dim strApprovals As String
    
        strApprovals = "[MSNum] Is Not Null"
    
        Me!subOrderDS1.Form.Filter = strUpcoming
        Me!subOrderDS1.Form.FilterOn = True
    
    End Sub
    Public Sub Upcoming()
    
        Dim strUpcoming As String
    
        strUpcoming = "[MSNum] is NOT null AND " _
                            & "[MSRNum] is NOT NULL AND " _
                            & "[SSPNNum] is NOT NULL AND " _
                            & "[AprHandShake] is NOT NULL AND " _
                            & "([ExpirationDate] - Date() " _
                            & "< 95 OR [ExpirationDate] is null)"
    
        Me!subOrderDS2.Form.Filter = strUpcoming
        Me!subOrderDS2.Form.FilterOn = True
    
    End Sub
    And:
    Code:
    Private Sub tbMain_Change()
    
        Select Case tbMain
    
            Case 0 'Pending Orders
                Me!subOrderDS0.Form!MSNum.ColumnHidden = True    'Hide MSNum
                Me!subOrderDS0.Form!MSRNum.ColumnHidden = True   'Hide MSRNum
                Me!subOrderDS0.Form!SSPNNum.ColumnHidden = True  'Hide SSPNNum
                Call Pending
    
            Case 1 'Approvals
                Me!subOrderDS1.Form!MSNum.ColumnHidden = False    'Unhide MSNum
                Me!subOrderDS1.Form!MSRNum.ColumnHidden = False   'Unhide MSRNum
                Me!subOrderDS1.Form!SSPNNum.ColumnHidden = False  'Unhide SSPNNum
                Call Approvals
    
            Case 2 'Upcoming Orders
                Me!subOrderDS2.Form!MSNum.ColumnHidden = True    'Hide MSNum
                Me!subOrderDS2.Form!MSRNum.ColumnHidden = True   'Hide MSRNum
                Me!subOrderDS2.Form!SSPNNum.ColumnHidden = True  'Hide SSPNNum
                Call Upcoming
    
        End Select
    End Sub

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    Sounds like you have the same sub or function defined mire than once. Either declare as private or rename.

    If that doesn't clear tbe fault it could be a corruption.
    Take a backup, compact and repair the backup then compile the code
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

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