gpotenza
asked on
Convert Text to Time and Filter
I have a fieldin a table with a datatype of Text that I can use the Format([CollectTime],"hh:n n:ss") function to successfully text to time. However I need to filter this data in the same query.
For example >=#15:15:00#
When I do I do not get results even though I can see some would qualify.
Help this is urgent!
For example >=#15:15:00#
When I do I do not get results even though I can see some would qualify.
Help this is urgent!
ASKER
The data in the field represents a time that I need to filter by a timespan. (for example from 15:00 to 20:00) How would I do that if the field datatype is text?
If the text is stored as hh:mm, then try:
[TimeField] Between "15:00" And "20:00"
or if that does not work:
[TimeField] >= "15:00" And [TimeField] <= "20:00"
Why are you storing this as text and not as datetime?
[TimeField] Between "15:00" And "20:00"
or if that does not work:
[TimeField] >= "15:00" And [TimeField] <= "20:00"
Why are you storing this as text and not as datetime?
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
>>datatype of Text
If the data type is text, then why are you using a data type of datetime for the filter comparison?
Compare text with text and datetime with datetime; when you try to mix them up you can get
unexpected results.