I m trying to get a selection from a table by using vba code. Nothing weird at all. But somewhere i fail.
So i will give a part of my code:
Dim Z_Datum as date
Z_datum = rsTimeTable.Fields("ColumnName"). Value (this gives the dutch notation of date and time 8-10-2024 19:57:28)
I try to use this in the following statement
sql5 = "SELECT * FROM DATA_CHECK_KLW_2024 where Year = " & Jaar & " And Number = '" & TankNummerSelect & "' And InvoerDatum = #" & Format(Z_Datum, "mm/dd/yyyy hh:nn") & "#;"
Set rs5 = db.OpenRecordset(sql5)
This does not work
If I change Z_datum into a fixed datum then it works:
Z_Datum = #10/8/2024 7:57:28 PM#
So how can I rewrite the result 8-10-2024 19:57:28 into #10/8/2024 7:57:28 PM#?
So i will give a part of my code:
Dim Z_Datum as date
Z_datum = rsTimeTable.Fields("ColumnName"). Value (this gives the dutch notation of date and time 8-10-2024 19:57:28)
I try to use this in the following statement
sql5 = "SELECT * FROM DATA_CHECK_KLW_2024 where Year = " & Jaar & " And Number = '" & TankNummerSelect & "' And InvoerDatum = #" & Format(Z_Datum, "mm/dd/yyyy hh:nn") & "#;"
Set rs5 = db.OpenRecordset(sql5)
This does not work
If I change Z_datum into a fixed datum then it works:
Z_Datum = #10/8/2024 7:57:28 PM#
So how can I rewrite the result 8-10-2024 19:57:28 into #10/8/2024 7:57:28 PM#?