I want to count the call number, Datecall
, [Username]
is the name of fields of table BCKHDY
but why numbercall
always equal 0. If I delete AND DateCall= #" & DateFrom & "#
, code run, that mean there is something wrong with Datecall
. What 's wrong?
Private Sub txtnbCall_Click()
Dim mydept As Integer
DateFrom = Me.txtfrom.Value
User = Forms![Navigation form]![txtLogin].Value
If Not IsNull(DLookup("Deptname", "tblUser", "UserLogin = '" & User & "'")) Then
mydept = DLookup("Deptname", "tblUser", "UserLogin = '" & User & "'")
Me.txtnbCall = numbercall(mydept, DateFrom)
End If
End Sub
Public Function numbercall(ByVal mydept As Integer, _
ByVal DateFrom As Date) As Integer
numbercall = DCount("CompanyName", "BCKHDY", _
"[UserName] = " & mydept & "AND DateCall >= #" & DateFrom & "#")
End Function