Like statement for date/time criteria

  • Thread starter Thread starter one1george
  • Start date Start date
O

one1george

hello,

i am trying to use the like statement as a criteria in a
query.
i know how to use the like '*' for text , how would i use
it for date/time?

thanks
 
You wouldn't. What are you tring to do? If you want to match only the
month, you will have to use the datepart function to compare only the
months, for example.
 
here is an example of how i am trying to use the like
statememt.....
this works for text but not date/time.
strEvTraining = " Like '*' "

I have tryed to change to code too " like #*# " but it
won't work

thanks
robin
 
I understand what you have tried. My question is what are you trying to
accomplish?

Your testing on a date/time field? What do you want to find?

Give me an example of the dates in your records and tell me which ones
should pass the test and which should fail.

The short answer is that you can't use "*" with date fields. The field does
not really contain the value you see. It contains a number that symbolizes
the date and time. If you tell us what you want to get, then we can tell
you how to pull out a part of that date and test against it.

You can't just pull like October &"*" for example because the
date field really contains something like 13564151 which does not have
October in it.

Tell us what you want to get in your query and what your criteria is.

Rick B
 
In rereading your post, it shounds like you want records regardless of the
date. If that is true, then just leave the criteria blank. You don't need
to put a criteria in if you want to pull all records.
 
Thanks for your help.

i am trying to run a dynamic query
using a combo control to set the query criteria.
i can set the code to accept text input using the like '*'
statement in the code and at the query but i want to
search by date and the like '*' will not accept date/time
criteria i am using in the combo control.
i did some reading and discovered that the # is used when
setting criteria when using date/time.
what i am looking for is the code for the like statement
that will translate to the query criteria ...?

thanks
 
Back
Top