Global Veriable ... Where to declare so all forms can see?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm having some serious headaches trying to determine where to set a global veriable that all my forms can see

I've got one form at comes up ... and gets a value. Then all the additional forms will be filtered on that value

I know this has to be simple... and for some reason seem to be missing it

Public CurFiltered as Integer works fine for that first form. But all the additional forms have no idea what that veriable is

Chris
 
Put it in a Module, not in the code associated with a form.

--
Doug Steele, Microsoft Access MVP

(No private e-mails, please)



Chris B said:
I'm having some serious headaches trying to determine where to set a
global veriable that all my forms can see.
I've got one form at comes up ... and gets a value. Then all the
additional forms will be filtered on that value.
I know this has to be simple... and for some reason seem to be missing it.

Public CurFiltered as Integer works fine for that first form. But all the
additional forms have no idea what that veriable is.
 
I've tried in a Module

The forms still can't see it

Is there something I need to do with the Module to be sure that the Variable gets declared

Following is my module "PuBVar
 
I've also used a text box on the main form. The main form
is never closed, and then you can reference it: Forms
("frmSwitchboard").txtHiddenBox.Value


Chris Nebinger


-----Original Message-----
I'm having some serious headaches trying to determine
where to set a global veriable that all my forms can see.
I've got one form at comes up ... and gets a value. Then
all the additional forms will be filtered on that value.
I know this has to be simple... and for some reason seem to be missing it.

Public CurFiltered as Integer works fine for that first
form. But all the additional forms have no idea what that
veriable is.
 
Chris said:
I'm having some serious headaches trying to determine where to set a global veriable that all my forms can see.

I've got one form at comes up ... and gets a value. Then all the additional forms will be filtered on that value.

I know this has to be simple... and for some reason seem to be missing it.

Public CurFiltered as Integer works fine for that first form. But all the additional forms have no idea what that veriable is.


If the first form will always be open when the other forms
want to get the value of the variable, then the other forms
can refer to the variable as a property of the first form
object:

Forms!firstform.CurFiltered

If the first form might not be open, then you should place
the public variable's declaration in a standard module.
 
can you reference it by
PuBVar.CurProject?

perhaps some other variable has the same name
Order of picking:
variables declared inside the procedure
variables declared outside the procedure (public)
-----Original Message-----
I've tried in a Module.

The forms still can't see it.

Is there something I need to do with the Module to be
sure that the Variable gets declared?
 
Back
Top