reformat data field in a query?

G

George Applegate

Hello,

Can anyone point me to an example where I can do the following?
I have a date that is not defined as a date but simply a character
field, say 01/24/2008.

How can I reformat this date to be say 2008/01/24 in a query? Is that
possible?

I have a payroll query that I want to extract records that are greater
than say 12/21/2008 and less than 01/05/2009; but obviously, that
query won't work with the data formated the way it is. It thinks the
01/05/2009 records are less and the 12/21/2008 because it's not a true
date field (or that's what I'm guessing).

So, I want to change the query to reformat the date from say
12/27/2008 to be 2008/12/27 and then I can still do by greater than
and less than comparisons by looking at dates between 2008/12/21 and
2009/01/05.

I'm just not sure how to reformat a field or if I can even do that in
a query???

Can anyone give me some assistance or point me to an example
somewhere?

Thanks so much in advance, and Merry Christmas!
ga
George Applegate
(e-mail address removed)
 
J

Jeff Boyce

George

One thing you could try would be to add a new field to your query that
converts the text to an actual date, then sort/select on that.

Take a look at the CDate() function ... your new query field might look
something like:

NewQueryField: CDate([YourTextFieldName])

Good luck

Regards

Jeff Boyce
Microsoft Office/Access MVP
 

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