Using a Public Array

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

Guest

I would like to populate an array from a form event, and use the array from
other procedures of the same form. I can't declare the array as public at
the module level, however. Can I make an array accessible to all procedures
in a module?
 
Declare the array in a module (not a class module nor the module associated
with any form or report)
 
Because what's declared in a form's module is local to that form only.

You can refer to the form to get at public variables defined in the form:

Form_NameOfForm.Array

or

Forms("NameOfForm").Array

However, that only works while the form's open. If you close the form, all
variables disappear.
 
Because what's declared in a form's module is local to that form
only.

You can refer to the form to get at public variables defined in
the form:

Form_NameOfForm.Array

or

Forms("NameOfForm").Array

However, that only works while the form's open. If you close the
form, all variables disappear.

And you can't do it for arrays, which cannot be a public member of
any kind of class module (including form modules).
 
Back
Top