Select Qry Range

G

Guest

Hi: I have a table in an access database and would like to write a select qry
on one field that currently has a date in a format like, 2006-05-12-15.47.50.
Is it possible to have a qry that will pull a range (From and To) within
that one field, by only specfiying the 2006-05-12-**.**.**? Thanks.
 
G

Guest

You would use Between Like "2006-05-12-*" And Like 2006-05-12-*"

But you will be better off in the long run the revise your database and use
a datatype DateTime instead of a text field.
 
J

John Spencer

Not fast but use a calculated field to get a real date and then use a date
range on that


Field: JustTheDate: DateValue(Left(YourDateField,10))
Criteria: Between #2006-05-01# and #2006-05-30#

To be really safe, you might test the field value first to make sure it will
return a date

IIF(IsDate(Left(YourDateField,10)),DateValue(Left(YourDateField,10)),Null)

Or you could try
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Problem with Cross qry 1
Top 2 within a date range. 2
query very slow 5
Getting a null value to display zero in count query 1
Combining Queries (2) 1
Union Queries 1
Combining Queries 4
query too slow 1

Top