Easy question - public variables?

rhesus

Registered User.
Local time
Today, 09:56
Joined
Dec 11, 2002
Messages
22
I am trying to define a variable in one module that can be used in another. I seem to understand that in order to do this, you need to declare it as a public var. Well I do this, but when I open the second module to access this variable, I am told it's undefined. Anyone help please? (I'm sure it's easy, I've just never had a need for globals in Access)

Thanks!
 
See Access Help for "property" procedures.

Basically, you define a variable in a module and then create public functions to get and put a value out or in.

RichM
 
Thank you sir
 
Edit: Okay I have figured out how to create a function that will return what ever value I want. Now, I am having the same problem, only in a different module. Here is the function from the first module:

Code:
 Public Function GetSearchType() As Integer
    GetSearchType = intSearchType
End Function

and here is the call from the other module:

Code:
 Private Sub Form_Load()
    Dim intTest As Integer
    
    intTest = GetSearchType()
End Sub

However, it still says "Sub or function not defined."
 
Last edited:
Sigh... answered my own question again... I needed to have these in a regular module, not part of a form. Kudos to RichM for pointing me in the right direction :D
 

Users who are viewing this thread

Back
Top Bottom