MS Access extract date
Posted on 2012-09-07
I'm having a little bit of difficulty trying to extract a date out of some fields because the format changes slightly on every record.
The fields are like:
Dec 5 (0.5hr)
Dec 5, 12 (0.5hr)
March 10, (.75hr)
January 7, 15 (1hr)
I have this so far:
comma_exists = InStr(1, ItemLineDesc, ",")
If (comma_exists > 0) Then
first_date = Left(ItemLineDesc, InStr(1, ItemLineDesc, ","))
first_date = Left(ItemLineDesc, InStr(4, ItemLineDesc, " "))
But with the comma I still have the comma at the end for the variable first_date when there is a comma.
I basically just need the date. Any help is appreciated.