GiraffetheGeek
Board Regular
- Joined
- May 25, 2011
- Messages
- 58
Hi there
I have a userform that has 20 lines of 4 text boxes and one button on each line.
I want the button to open a second userform that has only one line of 4 text boxes and copy the text in it line of text boxes to the text boxes in the second user form.
I have declared these at the top of the first userform's code
The code I have for the button is
And the code I have for the initialise function on the second userform is
However nothing is being put into the text boxes on the second userform. I know the varibale NameToPass, DisToPass etc are being populated correctly so I figure it has something to do with going from one form to another.
I suppose I could copy the data to a sheet first and then pull the data from the sheet to the new user form, but would like to avoid that and teach myself how to pass data from one form to another.
Cheers in advance
I have a userform that has 20 lines of 4 text boxes and one button on each line.
I want the button to open a second userform that has only one line of 4 text boxes and copy the text in it line of text boxes to the text boxes in the second user form.
I have declared these at the top of the first userform's code
Code:
Public NameToPass As String
Public DisToPass As String
Public HelpToPass As String
Public CMToPass As String
The code I have for the button is
Code:
Private Sub Btn_Week1Appt1_Click()
NameToPass = WB_TxtBox_NameWeek1Appt1.Text
DisToPass = WB_TxtBox_DisWeek1Appt1.Text
HelpToPass = WB_TxtBox_HelpWeek1Appt1.Text
CMToPass = WB_TxtBox_CMWeek1Appt1.Text
Enter_Appt.Show
End Sub
And the code I have for the initialise function on the second userform is
Code:
Private Sub UserForm_Initialize()
Box_EnterName.Text = NameToPass
Box_EnterDis.Text = DisToPass
Box_EnterHelp.Text = HelpToPass
Box_EnterCM.Text = CMToPass
End Sub
However nothing is being put into the text boxes on the second userform. I know the varibale NameToPass, DisToPass etc are being populated correctly so I figure it has something to do with going from one form to another.
I suppose I could copy the data to a sheet first and then pull the data from the sheet to the new user form, but would like to avoid that and teach myself how to pass data from one form to another.
Cheers in advance