change text to a date in a query

deb

Active Member
Joined
Feb 1, 2003
Messages
400
Using Access2K.

The data imported into a table looks like this...

White| |Greg|20oct2002|

I used a query and parsed it into individual fields using formats simular to the one below.

WEDate: Left$([WEDate2],InStr([WEDate2],"|")-1)

After parsing, parsing and parsing again.
I now have 3 fields...
White and Greg and 20oct2002

The problem now, is that the date is in text format.

How can I make the query read this field as a date?

Thanks in advance,
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
If you wrap the function that you used to get the date with the CDate() function it will force it into a date for you.

HTh

Peter
 
Upvote 0
I tried...
WEDate: CDate(Left$([WEDate2],InStr([WEDate2],"|")-1))

and the query fields show as #Error.

What did I do wrong?
 
Upvote 0
It looks as if Access does not recognise 20oct2002 as a date.
You will need to split it further :(
it will probably be easier to do this as a secon step rather than try to combine into one long function!
dDate: =CDate(Left([WEDate],2) & " " & Mid([WEDate],3,3) & " " & Right([WEDate],4))
This assumes that your date has a ddmmmyyyy format.

HTH

Peter
 
Upvote 0

Forum statistics

Threads
1,221,560
Messages
6,160,493
Members
451,653
Latest member
agata

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top