Hi all,
I have been scratching my head over this one for a day now!
I have a word 2007 document with 2 user forms, Form1 and Form2. Form2 is activated from Form1 and should let the user select a value from a listbox and have that value sent to a textbox Text1 in Form1.
I am doing this as follows:
in Form1 module
in Form2 module
When the button click code runs in Form2, nothing appears in Field1 on Form1.
While trying to resolve this I found that if I add a command button to Form1 that says
It returns the selected value, even though Field1 appears blank.
If I add a line that says
It returns no value.
If I run a line from Form1 that says
It sets the value of Field1 to the value that was previously selected in Form2.
I've tried refreshing and repainting Form1 and adding DoEvents and other methods of refreshing/updating the screen with no luck. It appears that when a variable is sent to a form1 field from form2, that variable can be found in form1.control but not me.control, and the value of me.control does not appear on form1 (even though me.name = form1 when checked.
I'm just about to bite the bullet and just put my big listbox on Form1 instead of its own form to resolve this but I'd be very grateful for any suggestions to fix/work around!
I have been scratching my head over this one for a day now!
I have a word 2007 document with 2 user forms, Form1 and Form2. Form2 is activated from Form1 and should let the user select a value from a listbox and have that value sent to a textbox Text1 in Form1.
I am doing this as follows:
in Form1 module
Code:
Public Sub SetCode(ByVal Code as String) Me.Field1.Value=Code End Sub
Code:
Private Sub Button_Click() SelectedValue = Me.ListBox1.Column(0) Call Form1.SetCode(SelectedValue) Unload Me End Sub
While trying to resolve this I found that if I add a command button to Form1 that says
Code:
msgbox Form1.Field1.value
If I add a line that says
Code:
msgbox me.Field1.value
If I run a line from Form1 that says
Code:
me.Field1.value = Form1.Field1.value
I've tried refreshing and repainting Form1 and adding DoEvents and other methods of refreshing/updating the screen with no luck. It appears that when a variable is sent to a form1 field from form2, that variable can be found in form1.control but not me.control, and the value of me.control does not appear on form1 (even though me.name = form1 when checked.
I'm just about to bite the bullet and just put my big listbox on Form1 instead of its own form to resolve this but I'd be very grateful for any suggestions to fix/work around!