How to take a string and parse it to look like a date

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

I have a string in a field named "Samp_Date" that is like this: 20021002.

I am going to run a make table query, and want to have it so All of the
values in the Samp_Date field convert to look like this: 10/02/02.

Also, if you can tell me where exactly I'm supposed to place the formula,
and the syntax for the new field name, I'd apprieciate that too.

Following the execution of the query, the newly made table will be exported
to MS Excel, so if there are any important date format issues, please include
them in your response.

What do you suggest?

TIA,

Phil
 
This assumes that all months will use two digits and all days will use two
digits. For example, April 5th would be 20060405 and not 200645. In you
query, select an empty column and put this in the top (field) cell:
NewDate:DateSerial(CInt(left$([Samp_Date],4)),CInt(Mid$([Samp_Date],5,2)),CInt(Right$([Samp_Date],2)))

The only other suggestion is that the field in destination table be a date
field.

Barry
 
Back
Top