E
ericm
I cannot get the value of location 1 (form field "drug1") copied to location
2 (form field "drug2") when the check box (check box "copy1") is checked. I
instead get a blank field at location 2.
The following macro ("UCFCopy1") runs upon exit of the checkbox field :
Sub UCFCopy1()
If ActiveDocument.FormFields("copy1").CheckBox.Value = True Then
ActiveDocument.FormFields("drug2").Result =
ActiveDocument.FormFields("drug1").Result
Else: ActiveDocument.FormFields("drug2").Result = "B"
End If
End Sub
Note that "B" in the above macro is to simply test the value passed through
the macro. When this macro runs and the box is checked, nothing appears in
the form field "drug2" (the text from "drug1" should appear but does not).
When the checkbox is unchecked the form field "drug2" displays "B".
Also note that the screen (on my computer) flashes TWICE when the checkbox
is NOT CHECKED and only flashes ONCE when the checkbox is checked, as though
it is refreshing the contents of the entire screen. I have tried various
variables, declaring variables and removing formatting in the macro/document
without success.
The document in which this macro is executing contains maybe 100 assorted
form fields, checkboxes and field references.
I used the exact same macro in another document I called "filltest" to
simply test the macro's integrity. The "filltest" document consists of
little more than two form fields ("drug1" "drug2") and a checkbox ("copy1").
The macro works there.
Any insight you have would be appreciated.
2 (form field "drug2") when the check box (check box "copy1") is checked. I
instead get a blank field at location 2.
The following macro ("UCFCopy1") runs upon exit of the checkbox field :
Sub UCFCopy1()
If ActiveDocument.FormFields("copy1").CheckBox.Value = True Then
ActiveDocument.FormFields("drug2").Result =
ActiveDocument.FormFields("drug1").Result
Else: ActiveDocument.FormFields("drug2").Result = "B"
End If
End Sub
Note that "B" in the above macro is to simply test the value passed through
the macro. When this macro runs and the box is checked, nothing appears in
the form field "drug2" (the text from "drug1" should appear but does not).
When the checkbox is unchecked the form field "drug2" displays "B".
Also note that the screen (on my computer) flashes TWICE when the checkbox
is NOT CHECKED and only flashes ONCE when the checkbox is checked, as though
it is refreshing the contents of the entire screen. I have tried various
variables, declaring variables and removing formatting in the macro/document
without success.
The document in which this macro is executing contains maybe 100 assorted
form fields, checkboxes and field references.
I used the exact same macro in another document I called "filltest" to
simply test the macro's integrity. The "filltest" document consists of
little more than two form fields ("drug1" "drug2") and a checkbox ("copy1").
The macro works there.
Any insight you have would be appreciated.