Results 1 to 2 of 2
  1. #1
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 8 Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496

    Public variable becomes null - can't figure out why

    I have in a module:

    Code:
    'variables to store current school information for clustering schools with other schools
    Public tmpSchoolIDstore As Variant, tmpClusterIDstore As Variant, tmpStateIDstore As Variant, tmpAreaIDstore As Variant
    
    
    'method to store the current school into the variables used on the cluster form
    Public Sub storeVarsCluster(SchoolsID As Variant, ClusterID As Variant, StateID As Variant, AreaID As Variant)
    
    
    Debug.Print "Test 1 " & SchoolsID
    Debug.Print "Test 2 " & ClusterID
    Debug.Print "Test 3 " & StateID
    Debug.Print "Test 4 " & AreaID
    
    
    
    
    tmpSchoolIDstore = SchoolsID
    tmpClusterIDstore = ClusterID
    tmpStateIDstore = StateID
    tmpAreaIDstore = AreaID
    
    
    Debug.Print "TEMPS: " & tmpSchoolIDstore & " " & tmpClusterIDstore & " " & tmpStateIDstore & " " & tmpAreaIDstore
    End Sub
    for some reason on a form if I do debug.print on one of the public variables - I get nothing

    Inside the module sub procedure the debug.print works fine - outside it no longer stores the information

    i.e.
    Debug.Print "Test " & tmpSchoolIDstore

  2. #2
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 8 Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    Quote Originally Posted by Ruegen View Post
    I have in a module:

    Code:
    'variables to store current school information for clustering schools with other schools
    Public tmpSchoolIDstore As Variant, tmpClusterIDstore As Variant, tmpStateIDstore As Variant, tmpAreaIDstore As Variant
    
    
    'method to store the current school into the variables used on the cluster form
    Public Sub storeVarsCluster(SchoolsID As Variant, ClusterID As Variant, StateID As Variant, AreaID As Variant)
    
    
    Debug.Print "Test 1 " & SchoolsID
    Debug.Print "Test 2 " & ClusterID
    Debug.Print "Test 3 " & StateID
    Debug.Print "Test 4 " & AreaID
    
    
    
    
    tmpSchoolIDstore = SchoolsID
    tmpClusterIDstore = ClusterID
    tmpStateIDstore = StateID
    tmpAreaIDstore = AreaID
    
    
    Debug.Print "TEMPS: " & tmpSchoolIDstore & " " & tmpClusterIDstore & " " & tmpStateIDstore & " " & tmpAreaIDstore
    End Sub
    for some reason on a form if I do debug.print on one of the public variables - I get nothing

    Inside the module sub procedure the debug.print works fine - outside it no longer stores the information

    i.e.
    Debug.Print "Test " & tmpSchoolIDstore
    sorry fixed - naming was wrong for some reason.... changed names and it now works

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 01-04-2014, 09:44 PM
  2. How to use global/public variable
    By mrbabji in forum Programming
    Replies: 7
    Last Post: 05-18-2013, 10:08 PM
  3. Query to figure out null cells.
    By chrisfl in forum Queries
    Replies: 1
    Last Post: 04-23-2013, 03:07 PM
  4. Replies: 1
    Last Post: 03-28-2013, 07:54 AM
  5. Help with a Null Variable Issue
    By EDNYLaw in forum Access
    Replies: 6
    Last Post: 03-26-2013, 10:56 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums