S
Scott
I have a datetime field and i'm trying to return records from 5/24/2004
5:30:00 AM to 5/25/2004 5:29:59 AM.
If I use a view, the correct records are returned. If I use VBA and open an
ADO recordset illustrated below, I get very strange numbers that are
definetly not correct. What time of datetime syntax does VBA need to
properly filter a recordset? Both FIGURE 1 and FIGURE 2 return incorrect
numbers. I can't tell what VBA is converting my datetime filter to. Any
help?
FIGURE 1
rs.Open "SELECT ShiftName, Sum(Downtime) AS SumOfDowntime " & _
"FROM mytable " & _
"WHERE myDateTimeField Between #5/24/2004 5:30:0# " & _
"AND #5/25/2004 5:29:59# " & _
"GROUP BY ShiftName"
FIGURE 2
rs.Open "SELECT ShiftName, Sum(Downtime) AS SumOfDowntime " & _
"FROM mytable " & _
"WHERE myDateTimeField Between #5/24/2004 5:30:00 AM# " & _
"AND #5/25/2004 5:29:59 AM# " & _
"GROUP BY ShiftName"
5:30:00 AM to 5/25/2004 5:29:59 AM.
If I use a view, the correct records are returned. If I use VBA and open an
ADO recordset illustrated below, I get very strange numbers that are
definetly not correct. What time of datetime syntax does VBA need to
properly filter a recordset? Both FIGURE 1 and FIGURE 2 return incorrect
numbers. I can't tell what VBA is converting my datetime filter to. Any
help?
FIGURE 1
rs.Open "SELECT ShiftName, Sum(Downtime) AS SumOfDowntime " & _
"FROM mytable " & _
"WHERE myDateTimeField Between #5/24/2004 5:30:0# " & _
"AND #5/25/2004 5:29:59# " & _
"GROUP BY ShiftName"
FIGURE 2
rs.Open "SELECT ShiftName, Sum(Downtime) AS SumOfDowntime " & _
"FROM mytable " & _
"WHERE myDateTimeField Between #5/24/2004 5:30:00 AM# " & _
"AND #5/25/2004 5:29:59 AM# " & _
"GROUP BY ShiftName"