That would be one way. I would like the answer to Skip's question.
"What I want to be able to do is when I close the second form automatically enter that data in the variable into the correct textbox on the first form."
If the data on FormA is a compilation of data on FormB, if there is no
user input, then use a Label, not a textbox. Textboxes are for user input.
Userform1:
one label: lblMush_It_Together
two commandbuttons: SubForm and Exit
Code:
Sub cmdExit_Click
Unload Me
End Sub
Sub cmdSubForm_Click()
Userform2.Show
End Sub
Userform2:
three textboxes: Textbox1, Textbox2, Textbox3
one commandbutton: cmdMush_Exit
Code:
Sub cmdMush_Exit_Click()
Userform1.lblMush_It_Together.Caption = _
TextBox1.Text & TextBox2.Text & TextBox3.Text
Unload Me
End Sub
The commandbutton on the second userform, concatenates the three textboxes (on userform2), dumps that into the Label on userform1, and unloads.
You
could use a public variable, but it is not - at least as you have stated it - required.
The point being, is that if the compilation does NOT require further user input, then do NOT use a textbox for it. Use a Label.
faq219-2884
Gerry
My paintings and sculpture