I have below query
sql_query = "select * from bericht where fromtime = " & Me.von & " and b_date = #" & Me.l_date & "#"
it print following line by debug.
select * from bericht where fromtime = 6 and b_date = #1/30/2020#
in table the b_date is dateTime field. ( linked table from SQL server in Msaccess)
in this table there is data exist with 1/30/2020 2:00:00 PM where fromtime is also 6.
why query didn’t return any data?
can msaccess cannot search date in datetime field?
PS: fromtime is intiger not time field.
Advertisement
Answer
Because #1/30/2020# <> 1/30/2020 2:00:00 PM.
Convert the column to a date, rather than a datetime, before you do the comparison.
... and DateValue(b_date) = #" & Me.l_date & "#"
This will return all rows from that date that meet your other condition.