Re: global dim & set

From: Mike Labosh (mlabosh_at_hotmail.com)
Date: 07/29/04

  • Next message: Andy Pope: "Re: Enter key ..in Listview"
    Date: Thu, 29 Jul 2004 15:51:11 -0400
    
    

    Open up any standard module (not a class or form module).
    At the top of the code, you will see something like this:

    Option Compare Database
    Option Explicit

    Right underneath those, do something like this:

    Public g_bDebugMode As Boolean

    When your application starts up, some code could set it to True.

    Alternatively, you could declare the variable as a constant and then
    manually change it when you want to see your messages:

    Public Const DEBUG_MODE = True

    -- 
    Peace & happy computing,
    Mike Labosh, MCSD
    "Do not meddle in the affairs of dragons, for
    you are crunchy, and taste good with ketchup"
    "mcalex" <mcmcalex@netscape.net> wrote in message
    news:8986672e.0407261949.6cb2cc03@posting.google.com...
    > Hi all
    > I'm a bit new to vb, and want to know if there is a way of declaring
    > and setting a global variable outside of any procedures.  I have a
    > public boolean (debugOn) that runs my debug.print statements if true
    > and doesn't clutter the immediate window if false.  Everything's fine
    > as long as I set it within procedures, but I cannot convince VBA to
    > set it outside of a procedure, ie at declaration time.  Is this
    > possible? and if so, how?
    >
    > Many thanks
    > Alex
    

  • Next message: Andy Pope: "Re: Enter key ..in Listview"

    Relevant Pages

    • Re: global dim & set
      ... Thx Mike ... > Open up any standard module. ... > Option Compare Database ... you could declare the variable as a constant and then ...
      (microsoft.public.office.developer.vba)
    • Re: Declare a public variabl
      ... declared in a standard module. ... declare DVal in the UF code module instead. ... Private Sub CommandButton1_Click ... Dim MyDate, MyWeekDay ...
      (microsoft.public.excel.programming)
    • Re: returing a WBS
      ... Option Compare Database ... Private globalLastWBS as String ' add this line ... Private Sub Form_AfterUpdate ... > since i have a compile error when i try to declare the ...
      (microsoft.public.access.queries)
    • Re: Public Variables
      ... > You declare them in a standard Module and make that Module the project's ... Scott M., ... if it is public and assembly scope, ...
      (microsoft.public.dotnet.languages.vb)
    • Re: How to pass a boolean
      ... declare it using the Private keyword in the Declarations section at the top ... of the module (after the Option Compare Database and Option Explicit ... Public Sub FirstSub() ...
      (microsoft.public.access.modulesdaovba)