I have a private sub procedure, i'm still quite novice at coding.
How would I create a sub procedure, so that when i clicked a command button (say cmdCheck) it would call the procedure using the code below???
The procedure could be called e.g. mailcheck
I would like the procedure to be called on many other cmd buttons as well.
Is there a better and cleaner way of writing the above if statement and how?
Thx Darin
How would I create a sub procedure, so that when i clicked a command button (say cmdCheck) it would call the procedure using the code below???
The procedure could be called e.g. mailcheck
I would like the procedure to be called on many other cmd buttons as well.
Code:
Private Sub tPassword_Exit(Cancel As Integer)
Dim CntRec, CntRecChase As Integer
CntRec = DCount("[ReadDiary]", "tblDiary", "[ReadDiary] =0 and [FollowOn] <>-1 and [RegNo] =tRegNo")
CntRecChase = DCount("[ReadDiary]", "tblDiary", "[FollowOn] =-1 and [RegNo] =tRegNo")
If CntRec > 0 Then
Me.lblNew.Visible = True
Else
Me.lblNew.Visible = False
End If
If CntRecChase > 0 Then
Me.lblFollowUp.Visible = True
Else
Me.lblFollowUp.Visible = False
End If
If CntRec > 0 Or CntRecChase > 0 Then
Me.cmdStaffDiary.Caption = Me.tName & " - You have messages NEW = " & CntRec & " REMINDER = " & CntRecChase
Me.Box113.Visible = False
Else
Me.Box113.Visible = True
Me.Box113.BackColor = 16768494
Me.cmdStaffDiary.Caption = "You have NO new Messages / Reminders"
End If
End Sub
Is there a better and cleaner way of writing the above if statement and how?
Thx Darin