Hi All;
I have been struggling with a very small issue with a form I am creating in Word 2010. This is most likely a quick element error.
Problem:
When a radio button is selected in a Word 2010 form, I want to hide or show a field based on this selection.
Current Steps Taken:
1) Set form field bookmark name to Return_Address
2) Created code with if then statement to control a "locked" form box. (working correctly)
Pack_Return = radio button
Pack_Lost = Radio Button
Pack_Both = Radio Button
TexBox1 = locked text box (no data entry allowed and working)
Return_Address = Form Field (named via bookmark command not working)
How can I show Return_Address and allow data entry when Pack_Return is selected and hide it and lock it blank when the other two radio buttons are selected. I know that there is a syntax error in the code.
Thanks,
Mike
I have been struggling with a very small issue with a form I am creating in Word 2010. This is most likely a quick element error.
Problem:
When a radio button is selected in a Word 2010 form, I want to hide or show a field based on this selection.
Current Steps Taken:
1) Set form field bookmark name to Return_Address
2) Created code with if then statement to control a "locked" form box. (working correctly)
Pack_Return = radio button
Pack_Lost = Radio Button
Pack_Both = Radio Button
TexBox1 = locked text box (no data entry allowed and working)
Return_Address = Form Field (named via bookmark command not working)
How can I show Return_Address and allow data entry when Pack_Return is selected and hide it and lock it blank when the other two radio buttons are selected. I know that there is a syntax error in the code.
Thanks,
Mike
Code:
Private Sub Pack_Return_Click()
Call TextBox1_Change
End Sub
Private Sub Pack_Lost_Click()
Call TextBox1_Change
End Sub
Private Sub Pack_Both_Click()
Call TextBox1_Change
End Sub
Private Sub TextBox1_Change()
Dim message As String
If Pack_Return = True Then
TextBox1 = "TO BE CONFIRMED BY SUPPLIER"
TextBox1.BackColor = &HFFFF&
Bookmarks("Return_Address").Hidden = True '<--- Know code error. Need solution for this
Else: TextBox1 = "N / A"
TextBox1.BackColor = &HFFFFFF
Return_Address.ShowHidden = False '<--- Know code error. Need solution for this
Application.ScreenUpdating = True
End If
End Sub