Date conversion

  • Thread starter Thread starter Marco
  • Start date Start date
M

Marco

I have to import some data into a Acces table
One of the txt-field is a string like
Str="tuesday 1 august 2006"

I want to get this in the table as a date like #01-08-2006#

How to?

Marco
 
Try removing the day name from that string:

Str="tuesday 1 august 2006"
Str=Mid(Str, InStr(Str, " ") + 1)

Then you can use CDate(Str) to give you the date.

Since you're trying to do this via an import, your best bet is to import the
data as text, add a date field to the table and write an UPDATE query to
populate the date field. The SQL of the query would look something like:

UPDATE MyTable
SET MyDateField = CDate(Mid([MyTextField], InStr([MyTextField], " ") + 1))
 
Back
Top