date format - datediff - Not working

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

Guest

I have a date format of 19850617, I need it to be 06/17/1985. The
19850617 is in text format and when I run a query to change it, it comes out
as 105 - for everyone.....May I please ask for some help.
 
I hope the field is always 8 chr, in that case you can try spliting the field
and then use the format

Format(Mid([FieldName],5,2) &"/" & Right([FieldName],2) & "/" &
Left([FieldName],4),"\#mm\/dd\/yyyy\#")
 
I have a date format of 19850617, I need it to be 06/17/1985. The
19850617 is in text format and when I run a query to change it, it comes out
as 105 - for everyone.....May I please ask for some help.

If the text value is always 8 characters, then:

DateSerial(Left([FieldName],4),Mid([FieldName],5,2),Right([FieldName],2))

will convert the text string 19850617 into a Date datatype value of
06/17/1985.
 
I have a date format of 19850617, I need it to be 06/17/1985. The
19850617 is in text format and when I run a query to change it, it comes out
as 105 - for everyone.....May I please ask for some help.

Don't confuse *datatype* with *format*.

A Text field is *not a date*. This is an eight-character text string, and will
not be recognized as a date by Access.

See the other posts in this thread for how to convert it to a Date/Time field,
which can then be formatted any way you choose.

John W. Vinson [MVP]
 
DateValue(Format([YourField],"@@@@\/@@\/@@")

That assumes that the values in your datefield will always yield a
correct date and never be null (blank).

'====================================================
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
'====================================================
 

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

Back
Top