Make a public form variable in the second form.
Load the second form modally.
Pass the value to the form as a propertie.
If you are ready in the form close is
The form properties stay preserved.
Do with them what you want (e.q. in the fist form).
Then, unload the second form.
'In Form1
Form2.Show vbModal
MsgBox "We still have the string: " & form2.my_second_string
Unload Form2
'Here Form2 is destroyed; with it the (public) string
'In Form2
Public My_Second_String as String
Private Sub Test()
My_Second_String = "The_Second_String"
Form2.hide
'Returns us to Form1, beyond: Form2.Show vbModal
'Preserve the string to take it to Form1
End Sub
--or--------------------------------------------------
'In Form1
Form2.Load
Form2.My_Second_String = "From Form1 to Form2"
Form2.Show
'in Form2
Public My_Second_String As String
Private Sub Test()
My_Second_String = "The_Second_String"
Form2.Hide
'returns us to Form1, beyond: Form2.Show vbModal
End Sub
(not tested!)
Reputation Points: 10
Solved Threads: 5
Junior Poster in Training
Offline 60 posts
since Mar 2007