HI all,
Trying to use more Private Subs and call to them to clean up a lot of useless code.
Below is a Private Sub and I want to know is there a better way to write it and what would that be?
I have a status lable on my header of form, It should be standard company unless one of the two
check boxes are clicked. If Preferred is checked, then do not use is not enabled, and vise versa and it
will change the lable to which ever is checked. This all works but something is telling me that the code in
the sub could be condensed into a shorter version but not sure how.
Thanks
Dave
Code:
Private Sub CompanyStatus()
If ChkPreferred = True Then
Status.Caption = "Preferred Company"
ChkNoSolicit.Enabled = False
ChkPreferred.Enabled = True
Else
Status.Caption = "Standard Company"
ChkNoSolicit.Enabled = True
ChkPreferred.Enabled = True
If ChkNoSolicit = True Then
Status.Caption = "Do Not Use"
ChkPreferred.Enabled = False
ChkNoSolicit.Enabled = True
Else
Status.Caption = "Standard Company"
ChkPreferred.Enabled = True
ChkNoSolicit.Enabled = True
End If
End If
End Sub