I am trying to get the total activities per company using ActivityID as the criteria. I created the following code:
The problem is when there are more than one criteria--that is:
it does not give me the correct total or it does not add. Then I tried it with:
or
but it does nothing.
What am I missing?
Public Function ActivityCount(ByVal strEventType As Integer) As Integer
End Function
ActivityCount = DCount("[ActivityID]", "Event", _
"[CompanyID] = " & Forms!frmViewEventHistory!txtCompanyID & " And " & _
"[ActivityID] = " & strEventType)
"[CompanyID] = " & Forms!frmViewEventHistory!txtCompanyID & " And " & _
"[ActivityID] = " & strEventType)
End Function
Private Sub Form_Current()
Me.txtCaption = "History of Events Thru " & Me.txtEndDate & " for " & Me.txtCompanyName
Me.txtSubmitted = ActivityCount(33)
Me.txtCalls = ActivityCount(23) Or ActivityCount(24)
Me.txtSurveys = ActivityCount(11) Or ActivityCount(12) Or ActivityCount(13) Or ActivityCount(14)
Me.txtNotes = ActivityCount(22)
Me.txtPhoneSurveys = ActivityCount(40)
Me.txtSends = ActivityCount(8) Or ActivityCount(10) Or ActivityCount(20)
End SubMe.txtSubmitted = ActivityCount(33)
Me.txtCalls = ActivityCount(23) Or ActivityCount(24)
Me.txtSurveys = ActivityCount(11) Or ActivityCount(12) Or ActivityCount(13) Or ActivityCount(14)
Me.txtNotes = ActivityCount(22)
Me.txtPhoneSurveys = ActivityCount(40)
Me.txtSends = ActivityCount(8) Or ActivityCount(10) Or ActivityCount(20)
The problem is when there are more than one criteria--that is:
Me.txtCalls = ActivityCount(23) Or ActivityCount(24)
it does not give me the correct total or it does not add. Then I tried it with:
Me.txtCalls = ActivityCount(23) And ActivityCount(24)
or
Me.txtCalls = ActivityCount(23 And 24)
but it does nothing.
What am I missing?