DateTime Criteria??

K

koturtle

I have an access query linked from a SQL Union Qry. Within this SQL
query there is a datetime field that when linked to access comes
across as a text field.

The format looks like this: (2004-03-01 00:00:00.000)

it sorts correctly in the query but when i try to put a criteria in
like >2007* it doesn't work. I have tried to say greater than
2004-03-01 00:00:00.000 and even tried to format the field by
creating a new field using =left(d[datefield],10) and then putting the
criterial on that field with no luck.

Any ideas?
 
W

Wayne-I-M

This should do it

SELECT CDate(Left([DateField],InStr([DateField]," ")-1)) AS FormatedDate
FROM TableName
WHERE (((CDate(Left([DateField],InStr([DateField]," ")-1)))>#1/1/2007#));
 
K

koturtle

This should do it

SELECT CDate(Left([DateField],InStr([DateField]," ")-1)) AS FormatedDate
FROM TableName
WHERE (((CDate(Left([DateField],InStr([DateField]," ")-1)))>#1/1/2007#));

--
Wayne
Manchester, England.



koturtle said:
I have an access query linked from a SQL Union Qry.  Within this SQL
query there is a datetime field that when linked to access comes
across as a text field.
The format looks like this: (2004-03-01 00:00:00.000)
it sorts correctly in the query but when i try to put a criteria in
like >2007* it doesn't work.  I have tried to say greater than
2004-03-01 00:00:00.000  and even tried to format the field by
creating a new field using =left(d[datefield],10) and then putting the
criterial on that field with no luck.
Any ideas?- Hide quoted text -

- Show quoted text -


Worked great!
thanks
 
D

Dad

koturtle said:
I have an access query linked from a SQL Union Qry. Within this SQL
query there is a datetime field that when linked to access comes
across as a text field.

The format looks like this: (2004-03-01 00:00:00.000)

it sorts correctly in the query but when i try to put a criteria in
like >2007* it doesn't work. I have tried to say greater than
2004-03-01 00:00:00.000 and even tried to format the field by
creating a new field using =left(d[datefield],10) and then putting the
criterial on that field with no luck.

Any ideas?
 

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

Top