![]() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
![]() |

|
| Programming Error ! Programming error messages |
![]() |
|
SQL SELECT with DateTime
|
LinkBack | Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Administrator
Posts: 18,715
Join Date: Jan 2006
Rep Power: 10
IM:
|
INSERT INTO Table VALUES(...., '4/26/2007 5:25:59 PM', ....) but the SELECT statement never works when I specified the same string (it gives me Data Type Mismatch error): SELECT * FROM Table WHERE .... AND Time = '4/26/2007 5:25:59 PM' ... What is the correct way to do this? Thanks! |
|
|
|
|
|
|
|
|
#2 (permalink) |
|
Administrator
Posts: 18,715
Join Date: Jan 2006
Rep Power: 10
IM:
|
The reason your insert statement works is because you're inserting the date as a text string, but happens to fit the General Date/Time format. The select doesn't work the same way, it's value based and therefor the criteria has to match the data type for the field. Surrounding the date/time with # # tells Access Jet that it's a date. SELECT * FROM Table WHERE .... AND [Time] = #4/26/2007 5:25:59 PM# ... |
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|