Converting Text to Date

J

JWeaver

I have been put in charge of a database that was created a while ago. At the
time of creation, all date fields were formatted as Text fields. Some of
these fields have the dates entered as 07/01/08 Tue. How can I convert these
Text fields to Date fields so that the date will stay in the same format,
e.g., 2 digit month, 2 digit day, 2 digit year followed by first 3 letters of
the day of the week?

We have several people who enter data simultaneously in the database. They
are not consistent with the way they enter the dates which is why I would
like to change this field.
 
J

Jerry Whittle

To convert it into an actual date, something like this in a query:

TheDate: CDate(Left("07/01/08 Tue", Instr("07/01/08 Tue"," ")-1))

TheDate: CDate(Left([TheTextField],Instr([TheTextField]," ")-1))

Don't even worry about or even store the Tue part. You can find it out
anytime and display it in another field or text box like so:

Format(#07/01/08#, "ddd")

As far as others typing in the date different ways, once a date field you
can use an imput mask to force them to enter the date you way.
 

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