Carrying variables values from one subform to another

  • Thread starter Thread starter RHov
  • Start date Start date
R

RHov

I have a form with two separate subforms. One subform
has monthly data and the other has cumulative data for
the year. After the value for the 12th month of a year
is reached, the focus is switched to the corresponding
year in the cumulative subform. I need to set the value
of a variable which will then be used in the validation
procedure for the cumulative subform. Are static
variables the way to handle this? If so, where do I
declare and set their values? I was able to pass one
value by using the parent.tag, but I need to pass more
than one variable. Any ideas?
 
The easiest way is to declare global variables in a module.

eg

Public glngVariableName As Long

The variable glngVariableName can then be accessed from any part of the
program and will hold its value.

Rod Scoullar
 
Yes. set public variables in the forms class module (at the beginning of the
code after Option statements). you can set and access them from any function
or sub in that form. example:

Option Explicit
Public strValueOne as String
 
Back
Top