I have a form that has a yes checkbox, and a no checkbox. When users select one I need to copy the info from one form field to another formfield.
There has to be a way to get the same results more efficiently.
There seem to be too many ifs.........
Here is my current code:
Sub HBCBiweeklyChoice()
Dim YesChoice As CheckBox
Dim NoChoice As CheckBox
Set YesChoice = ActiveDocument.FormFields("AOCYes").CheckBox
Set NoChoice = ActiveDocument.FormFields("AOCNo").CheckBox
Application.ScreenUpdating = False
If YesChoice.Value = True And NoChoice.Value = True Then
MsgBox "Please Choose Yes OR No" & vbCrLf & "This will place the hours in the correct field Above", vbExclamation, "Select Agency of Choice"
End If
If YesChoice.Value = False And NoChoice.Value = False Then
MsgBox "You Must Pick One" & vbCrLf & "This Field Cannot Be Blank", vbExclamation, "Select Agency of Choice"
End If
If YesChoice.Value = True And NoChoice.Value = False Then
With ActiveDocument
.FormFields("HBCSMD").Result = ""
.FormFields("HBCSMN").Result = ""
.FormFields("HBCBiDay").Result = .FormFields("MaineCare_Day_Hrs").Result
.FormFields("HBCBiNight").Result = .FormFields("MaineCare_Night_Hrs").Result
End With
End If
If YesChoice.Value = False And NoChoice.Value = True Then
With ActiveDocument
.FormFields("HBCBiDay").Result = ""
.FormFields("HBCBiNight").Result = ""
.FormFields("HBCSMD").Result = .FormFields("MaineCare_Day_Hrs").Result
.FormFields("HBCSMN").Result = .FormFields("MaineCare_Night_Hrs").Result
End With
End If
Application.ScreenUpdating = True
End Sub