提出问题提出问题
 

问题compile error Ambiguous name detected

  • 2009年7月12日 19:02wizard191 用户奖牌用户奖牌用户奖牌用户奖牌用户奖牌
     

    compile error
    Ambiguous name detected: Left

    The code stops in a private procudure and highlights   Left$



    Public Sub remove_letter2()

        Dim alpha(1 To 26) As Integer
        Dim x As Integer
        Dim f As Form
       
        Set f = Screen.ActiveForm
       
        For x = 1 To 26
            alpha(x) = 0
        Next x
        With rs_Client
            .MoveFirst
            Do Until .EOF
                alpha(Asc(Left$(!Surname, 1)) - 64) = 1
                .MoveNext
            Loop
        End With
        For x = 1 To 26
            If alpha(x) = 0 Then
               f("toggle" & (x + 9)).Visible = False
            End If
        Next x

    End Sub

全部回复

  • 2009年7月12日 22:36wizard191 用户奖牌用户奖牌用户奖牌用户奖牌用户奖牌
     

    Searching other posts it seems to be a name confliction which is why i've named this function remove_letter2 instead of remove_letter. I have used the remove_letter function in some other forms and the only other lefts are;


    If VBA.Mid(strInput, Len(strInput) - 2, 1) = "O" Then strInput = _
                Left(strInput, Len(strInput) - 3) & "0" & VBA.Right(strInput, 2)


    Case 6
                If RgExp.test(Left(strInput, 3) & " " & VBA.Right(strInput, 3)) = True Then
                     txtPostcode = Left(strInput, 3) & " " & VBA.Right(strInput, 3)
                Else
                    Exit Function
                End If


    .TypeParagraph
            .ParagraphFormat.Alignment = wdAlignParagraphLeft
            .TypeParagraph


    Payments.ClientNo FROM Client LEFT JOIN Payments ON Client.ClientNo