Microsoft KB Archive/40890

= BC &quot;Variable Name Not Unique&quot; on SUB with Period in Name =

Article ID: 40890

Article Last Modified on 11/21/2006



This article was previously published under Q40890



SUMMARY
If a Basic SUBprogram name contains a period (that is, a dot), then any variables that have the same name as the portion of the SUBprogram name that is left of the period produce a &quot;Variable name not unique&quot; error message from BC.EXE at compile time. The program does not produce the error inside the QB.EXE editor environment.

This information applies to Microsoft QuickBasic Versions 4.00, 4.00b, and 4.50 and Microsoft Basic Compiler Versions 6.00 and 6.00b for MS-DOS and MS OS/2.

This behavior does not occur in Microsoft Basic PDS Version 7.00. Basic PDS Version 7.00 will successfully compile a program under the above conditions.



MORE INFORMATION
The sample program below runs inside the QuickBasic environment. However, when compiled using BC.EXE, a &quot;Variable name not unique&quot; error message is produced.

It is recommended that variable and subprogram/function names contain no periods. Periods are now used by Basic in specifying individual elements of a user-defined type variable. To eliminate the problem in the program below, remove the period from the SUBprogram name.

The following is a code example: DECLARE SUB Test.one COMMON SHARED Test AS SINGLE Test = 4 CALL Test.one END

SUB Test.one PRINT &quot;in Test.one&quot; END SUB

Additional query words: QuickBas BasicCom

Keywords: KB40890

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.