Results 1 to 3 of 3

Thread: Module1 BasicQuestion

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Jan 2001
    Location
    Florida
    Posts
    3,216

    Question Module1 BasicQuestion

    BasicQuestion:

    If I place this code into a standard module then am I right in saying that variable conn is available to all forms, classes in the project?

    Option Explicit
    Public Conn As ADODB.Connection

  2. #2
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    Yep..

  3. #3
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    Code:
    Variables declared using the Public statement are available to all procedures in all modules in all applications unless Option Private Module is in effect; in which case, the variables are public only within theproject in which they reside.
    
    Caution   The Public statement can't be used in a class module to declare a fixed-length string variable.
    
    Use the Public statement to declare the data type of a variable. For example, the following statement declares a variable as an Integer:
    
    Public NumberOfEmployees As Integer
    
    Also use a Public statement to declare the object type of a variable. The following statement declares a variable for a new instance of a worksheet.
    
    Public X As New Worksheet
    
    If the New keyword is not used when declaring an object variable, the variable that refers to the object must be assigned an existing object using the Set statement before it can be used. Until it is assigned an object, the declared object variable has the special value Nothing, which indicates that it doesn't refer to any particular instance of an object.
    
    You can also use the Public statement with empty parentheses to declare a dynamic array. After declaring a dynamic array, use the ReDim statement within a procedure to define the number of dimensions and elements in the array. If you try to redeclare a dimension for an array variable whose size was explicitly specified in a Private, Public, or Dim statement, an error occurs.
    
    If you don't specify a data type or object type and there is no Deftype statement in the module, the variable is Variant by default.
    
    When variables are initialized, a numeric variable is initialized to 0, a variable-length string is initialized to a zero-length string (""), and a fixed-length string is filled with zeros. Variant variables are initialized toEmpty. Each element of a user-defined type variable is initialized as if it were a separate variable.
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

Posting Permissions

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



Click Here to Expand Forum to Full Width