Hi all and thanks in advance.
I would like to use a Recordset where I define the year, month, date
I have this code, however does not work, not really sure where to go from here:
Set Prod=oConnUSR.Execute("SELECT * FROM departures WHERE dep_date=>#"&Year(Date())&"# AND dep_date=>#"&Month(Date())&"# AND dep_date>#"&Day(Date())&"#")
I am just using Date() at the moment for testing, as they will be variables later on
Microsoft VBScript runtime error '800a000d'
Type mismatch: '[string: " & Day(Date()) & "]'
Set Prod=oConnUSR.Execute("SELECT * FROM departures WHERE dep_date=> " & DateSerial( " & Year(Date()) & " , " & Month(Date()) & " , " & Day(Date()) & " ) )
& Day(Date()) & " )" )
Set Prod=oConnUSR.Execute("SELECT * FROM departures WHERE dep_date=> " & DateSerial( " & Year(Date()) & " , " & Month(Date()) & " , " & Day(Date()) & " ) " )
-------------------------------------------------------------------------------------------------------------------------------------------------------------^
Set Prod=oConnUSR.Execute("SELECT * FROM departures WHERE dep_date=> " & _
"DateSerial(" & Year(yourdatevariable) & ", " & Month(yourdatevariable) & ", " & _
Day(yourdatevariable) & ")" )
Microsoft JET Database Engine error '80040e14'
Syntax error (missing operator) in query expression 'dep_date=> DateSerial(2022, 3, 2)'.
/home.asp, line 576
[dep_date]=>
Microsoft JET Database Engine error '80040e14'
Syntax error (missing operator) in query expression '[dep_date]=> DateSerial(2022, 3, 3)'.
/home.asp, line 576
[dep_date] >=
ADODB.Recordset error '800a0cc1'
Item cannot be found in the collection corresponding to the requested name or ordinal.
/home.asp, line 579
This is the code: Set Prod=oConnUSR.Execute("SELECT * FROM departures WHERE [dep_date]>= " & _
"DateSerial(" & Year(Date()) & ", " & Month(Date()) & ", " & _
Day(Date()) & ")" )
Set Prod=oConnUSR.Execute("SELECT * FROM departures WHERE dep_date>#"&Date()&"# ORDER BY dep_date")
?"SELECT * FROM departures WHERE [dep_date]>= " & _
"DateSerial(" & Year(Date()) & ", " & Month(Date()) & ", " & _
Day(Date()) & ")"
Then copy/paste the result of that operation (? is actually debug.print) into a query design window (SQL view) and run the query. Do you get the same error? If no error, or a different error message, what do you see?
?"SELECT * FROM departures WHERE [dep_date]>= " & _
"DateSerial(" & Year(Date()) & ", " & Month(Date()) & ", " & _
Day(Date()) & "
Seems like it didnt like the ?
dep_date>"&("DateSerial("&Year(Date)&","&Month(Date)&","&Day(Date)&")")&"
For some reason needed brackets around it and now it works fine
What exactly is not working?