Thanks everyone for the help. The suggestion about passing variables
would probably work. I had tried declaring the variables public but
that didn't seem to work. I did find the problem however. It seems
that I use a click event with the text boxes in the first userform.
When I changed the event to a change event and had the variables
declared public in the module Declaration area, things worked fine.
Since I previously had only one form and use a click event to initiate
the calculations, it worked fine. But when calling the second form
there wasn't a final click event to load the variables from the
textboxes. Just a beginners mistake. :-)
Thanks again,
Garry
za***@construction-imaging.com wrote:
gw********@gmail.com wrote:
I have created a userform with textboxes for data entry. I also have a
command button that calls a second useform. A user enters certain
information in the first useform but if he/she wants to do additional
calculations, they use the command button to bring up the second
userform and add additional information via textboxes in the second
form. However, the calculations need the data from both userforms.
Given that the variables are declared private and if they are changed
to public an error occurs, how can I make the variables entered in the
first userform available to the second userform?
As long as the instance of the first form was declared as public, the
second form should have access to all of the first form's textbox
controls and their text property.
Even if you take the advise of the other poster and store the values
entered in public properties in the first form, the still will be
available unless the instance of the first form's class is public.