• Ambiguous Name (2000)

    Author
    Topic
    #363717

    Hi all, I have somewhat followed the instructions in a previous post on ambiguous names, however, I am still stuck.

    I keep getting an error “Ambiguous Name Detected: ~” whenever I try to compile the project. If I go to any form in the project and try to step into the code, it returns the ambiguous name detected message with the form name added to the end. This is with every form in the project.

    Any ideas?

    Thanks,

    Viewing 2 reply threads
    Author
    Replies
    • #555890

      I don’t wish to pose any copywrite issues, so in the VBE – Help – Answer Wizard tab type in Ambiguous Name Detected and you will get a response of “Avoiding Naming Conflicts”

      Hope this helps.

    • #555891

      Michael hello

      I guess you have some thing in one of these categories:

      1) Two subroutines with the same name. Check all your names and change them a bit.
      2) You may have a name that is being confused with a Worksheet function. Look at your names of variables and objects and what have you.
      3) You maybe using a name that looks like a Reserved VBA Word. You can not name variables like ThisWorkbook or ActiveSheet.

      The BEST way to get rid of this is to follow naming conventions established by the expert community.
      For example instead of saying:
      Dim AlphabeticalCharacter as String
      I would say
      Dim sAlphabeticalCharacter as String , the s denotes String. It makes it easy on the programmer to understand and debug the code as well.

      Check “Guidelines for naming cells, formulas, and constants in Microsoft Excel” and “Visual Basic Naming Rules” in the OLH, plus consult the following MSKB articles: http:// support.microsoft.com/default.aspx?scid=kb;EN-US;Q211838 and http:// support.microsoft.com/default.aspx?scid=kb;EN-US;Q220613

    • #555979

      OK, I have narrowed this down to the most recent form I added…a 5 page multipage with about 300 textboxes (don’t ask, I won’t tell!). I removed this form and all is well. Guess I will have to import the form again and figure out where it is at.

      Also, for anyone out there who might have a similar problem. I first attempted to comment out the code with some of the forms I thought might be in question. One at a time, I commented code and compiled with the same error message. I finally found the guilty form because the compiler would not let me comment the code behind the guilty form. Every time I tried to comment the code in the guilty form, I got the ambiguous name message.

      Sooooo…if anyone is trying to track down a similar problem, you might try to comment it first. If you can, then that code in that module, or behind that form, or behind that sheet is not in question.

      Thanks,

      • #556490

        Mike

        IMHO developers should get into the habit of naming the objects they use just like variables and other objects.

        This has the added benefit that if International considerations are in order the code will be looking for a TextBox named tbFirstName not TextBox1 in English and what have you in other versions.

        Wassim

        • #556491

          Good point, also bear this in mind wink
          http://www.web-hits.org/txt/codingunmaintainable.html

          • #556494

            Mark

            Thanks Thanks Thanks… joy

            I saw that before and it made me laugh. Now I have the source and am looking for more if you have any send them my way.

            Wassim laugh

        • #556720

          True…the textbox in question was a transparent box with no border that was the result of a copy and paste which I forgot about. I just happened to select the entire page and saw it sitting there all by itself in the corner!

          Thanks,

    Viewing 2 reply threads
    Reply To: Ambiguous Name (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: