Results 1 to 3 of 3
  1. #1
    Lounger
    Join Date
    Aug 2002
    Posts
    28
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Global variable not global (2K)

    I am using :

    Option Compare Database

    Public VarName As String

    Private Sub xxxx_Click()
    { stuff }
    End Sub

    But VarName isn't available in any other module. What's wrong?

  2. #2
    Star Lounger
    Join Date
    Jan 2001
    Location
    Yorkshire, England
    Posts
    82
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Global variable not global (2K)

    I'm guessing you have your Public VarName As String in the code module for a form.
    Move it to a standard code module - should be ok then

  3. #3
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Global variable not global (2K)

    From your code, it looks like you declared VarName in a form's module. Therefore, it will only be available when the form is open. Move it to a regular module to have it available all the time.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

Posting Permissions

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