Passing Data Between Forms

  • Thread starter Thread starter Brian
  • Start date Start date
B

Brian

I have suffered a major brain fart.
I am trying to pass a county name from one form to
another. I am trying to use; Public CN as string in the
parent form and assigning the county name to CN. I wnat
to use it in other forms too. I thought using Public
would make the variable available anywhere in the
application. It is only usable in the parent form code
module.
I have missed something basic here, but my brain has
ceased to function (it's friday).

Any suggestions would be helpfull.

Thanks,

Brian
 
Where are you declaring it? It must be in the Declarations section at the very
top of the module, if you declare in a function or sub access to the variable
will be restricted to that procedure. Also if you declare in a form module the
form must be open and the variable referenced as form.variable. To just access
it by name it must be declared in a module from the modules tab.
 
Brian said:
I have suffered a major brain fart.
I am trying to pass a county name from one form to
another. I am trying to use; Public CN as string in the
parent form and assigning the county name to CN. I wnat
to use it in other forms too. I thought using Public
would make the variable available anywhere in the
application. It is only usable in the parent form code
module.
I have missed something basic here, but my brain has
ceased to function (it's friday).


What you say is true for module level, public variables in a
standard module. However, a form's module is a class module
and its module level, public variables are properties of the
class. This means that you have to reference it this way:
Forms!parentform.CN
 
Back
Top