Hello gusy,
Can somebody point out the mistake in my function? It is basically a DCount, and it should find records, but returns 0 all the time. My code is:
sftstart and sftend are functions which are returning dates. The funcion works fine if I omit the Between part of the criteria. So the problem is in that part.
WHat I'm doing wrong?
Can somebody point out the mistake in my function? It is basically a DCount, and it should find records, but returns 0 all the time. My code is:
Code:
Function cntkit(sftd As Date, sftn As String, typid As Integer, specpaint As Boolean) As Integer 'Counts jobs kitted during shift given by sftd and sftn
Dim timeformat As String
timeformat = "\#mm\/dd\/yyyy hh\:nn\:ss\#" 'need this, to convert it to US datetime format
cntkit = DCount("[JOB]", "Archive", "[Type] =" & typid & " And [Autfinish]=False And [SpecPaint] =" & specpaint & " And ([Kit] BETWEEN " & Format(sftstart(sftd, sftn), timeformat) & " AND " & Format(sftstart(sftd, sftn), timeformat) & ")")
End Function
sftstart and sftend are functions which are returning dates. The funcion works fine if I omit the Between part of the criteria. So the problem is in that part.
WHat I'm doing wrong?