B
bluewatermist
Hi
I'm having trouble making a function work. This function is too long, so I
have split it up. Below is an example. The below code call this function.
Unfortunately this function keeps looping and I can't get out of it. I'm at a
loss as to what to do. Hopefully you can help me.
Thank you.
test = Checkalllabels.check_labels and test = checkalllabels.check_labels1
If test = True Then
Exit Sub
End If
Function check_labels()
If CWC_Note.typeofcontact.Value = Clear Then
MsgBox "Type of call not selected", vbExclamation, ""
check_labels = True
CWC_Note.typeofcontact.SetFocus
ElseIf CWC_Note.nameofcontact.Value = Clear Then
MsgBox "Callers name required", vbExclamation, ""
check_labels = True
CWC_Note.nameofcontact.SetFocus
end if
call Check_labels1
end function
Function Check_labels1 ()
If CWC_Note.taxagentfirmname.Value = Clear And
CWC_Note.contactlistedon.Value = "CAC tax agent" Then
MsgBox "Tax agent firm name required", vbExclamation, ""
check_labels = True
CWC_Note.taxagentfirmname.SetFocus
ElseIf CWC_Note.taxagentfirmname.Value = Clear And
CWC_Note.contactlistedon.Value = "FBT tax agent" Then
MsgBox "Tax agent firm name required", vbExclamation, ""
check_labels = True
CWC_Note.taxagentfirmname.SetFocus
endif
end function
I'm having trouble making a function work. This function is too long, so I
have split it up. Below is an example. The below code call this function.
Unfortunately this function keeps looping and I can't get out of it. I'm at a
loss as to what to do. Hopefully you can help me.
Thank you.
test = Checkalllabels.check_labels and test = checkalllabels.check_labels1
If test = True Then
Exit Sub
End If
Function check_labels()
If CWC_Note.typeofcontact.Value = Clear Then
MsgBox "Type of call not selected", vbExclamation, ""
check_labels = True
CWC_Note.typeofcontact.SetFocus
ElseIf CWC_Note.nameofcontact.Value = Clear Then
MsgBox "Callers name required", vbExclamation, ""
check_labels = True
CWC_Note.nameofcontact.SetFocus
end if
call Check_labels1
end function
Function Check_labels1 ()
If CWC_Note.taxagentfirmname.Value = Clear And
CWC_Note.contactlistedon.Value = "CAC tax agent" Then
MsgBox "Tax agent firm name required", vbExclamation, ""
check_labels = True
CWC_Note.taxagentfirmname.SetFocus
ElseIf CWC_Note.taxagentfirmname.Value = Clear And
CWC_Note.contactlistedon.Value = "FBT tax agent" Then
MsgBox "Tax agent firm name required", vbExclamation, ""
check_labels = True
CWC_Note.taxagentfirmname.SetFocus
endif
end function