Problem with time format

pcc

Well-known Member
Joined
Jan 21, 2003
Messages
1,353
I am fairly new to Access SQL and cannot understand this.
I have a a table called 'Status' including this record
Filename Date Time
R2035009.MEA 14-Nov-07 23:14:16

If I run this query
SELECT * FROM Status
WHERE (filename = "R2035009.MEA") and (Date = #2007/11/14# ) and (time = #23:14:16#);

I get no records returned, but if I run this query

SELECT * FROM Status WHERE (filename = "R2035009.MEA") and (Date = #2007/11/14# ) and (time <> #23:14:16#);

then the record is returned.

I guess it's some sort of formatting problem but I don't know where to start.
Can anyone assist, please? :wink:
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
you shouldn't split up your date and time fields, it should be one column. If you're stuck with that format then I suggest you try to concatenate the two and query on that.

example:
Code:
SELECT * FROM Status 
WHERE (filename = "R2035009.MEA") and ([Date] + [time] =#2007/11/14 23:14:16#);

if you do that does it work?

PS you should avoid using DATE and TIME as field names.

hth,
Giacomo
 
Upvote 0
Thanks for reply. In the meantime I have found that this works, so I will stick with it.

SELECT * from Status where filename = "R2035009.MEA" and Date = #2007/11/14# and cstr(time)="23:14:16";


Many thanks once again.
Cheers
 
Upvote 0

Forum statistics

Threads
1,214,798
Messages
6,121,635
Members
449,043
Latest member
farhansadik

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top