Changing text field to Date

J

Jeff Boyce

First of all, if you are "linking to a ..." data source, you cannot "change
the ... field ... to a Date type". You can only make changes to the
underlying field data type when you are working with a 'local' table.

Next, you indicate that the field is a "date field" ... does that mean that
it holds dates? If so, is there an example of data now stored in that
field? You call it "text", but ???

If you use CDate() to convert to a date/time data type, why are you then
formatting the dates?

Why not just sort the converted value?

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
J

John W. Vinson/MVP

I am linking to a text file and I need to change the date field "Posting
Date" to a Date type. I am trying to use this code that I found on this
site:
Expr1: Format(CDate([Posting Date]),"mm/dd/yyyy"), but it doesn't work
correctly when I try to sort by the date, it is sorting like the date
field is still text (06/01/2008 is below 07/01/2008, when sorted
decending).
Thanks in advance.
Sean

The Format() function returns a Text value, not a date. Try sorting
just by CDate([Posting Date]).
 
M

metalone

I am linking to a text file and I need to change the date field "Posting
Date" to a Date type. I am trying to use this code that I found on this
site:
Expr1: Format(CDate([Posting Date]),"mm/dd/yyyy"), but it doesn't work
correctly when I try to sort by the date, it is sorting like the date
field is still text (06/01/2008 is below 07/01/2008, when sorted
decending).
Thanks in advance.
Sean
 
M

metalone

metalone;2877310 said:
I am linking to a text file and I need to change the date field "Postin
Date" to a Date type. I am trying to use this code that I found on thi
site:
Expr1: Format(CDate([Posting Date]),"mm/dd/yyyy"), but it doesn't wor
correctly when I try to sort by the date, it is sorting like the dat
field is still text (06/01/2008 is below 07/01/2008, when sorte
decending).
Thanks in advance.
Sean
Thanks for the information, I will give it a try. I should have state
in my first message, the field is in a Make table query and th
structure is already "mm/dd/yyy", but it is in text format.
Thanks again
Sea
 

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