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).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Public Dynamic Arrays 6
Shape Arrays VBA 0
Array basics! 3
Global Array in User Form 1
Passing Array to sub as parameter 3
Excel Wildcard in Excel array formula 0
Public array 1
MultiDimensional Array Syntax 4

Back
Top