Code:
Sub testDCount()
Dim intx As Integer
intx = DCount("*", "locaçao", " [dtLocação] <= Date() And Date() <= [dtfim] ")
End Sub
I created this routine (subProcedure) to test some of the values and attempts you have in
your module.
Code:
Function c1()
'd1 = "'#'" & Date & "'#'"
'MsgBox d1
'c1 = DCount("[codigo]", "locaçao", "[dtLocação] <= " & d1 & " And [DtFim] >= " & d1)
'c1 = DCount("[codigo]", "locaçao", "Format([dtLocação],'dd/mm/yyyy') <= #" & Format(Now, "mm/dd/yyyy") & "# And format([DtFim],'dd/mm/yyyy') >= #" & Format(Now, "mm/dd/yyyy") & "#")
'c1 = DCount("[codigo]", "locaçao", "[dtLocação] <= #" & Format(Now, "dd/mm/yyyy") & "# And format([DtFim],'dd/mm/yyyy') >= #" & Format(Now, "mm/dd/yyyy") & "#")
c1 = DCount("[dtlocação]", "locaçao", "#" & Date & "# Between format([dtLocação],'dd/mm/yyyy') And format([dtfim],'dd/mm/yyyy')")
'between
End Function