A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

date format - datediff - Not working



 
 
Thread Tools Display Modes
  #1  
Old April 12th, 2007, 09:50 PM posted to microsoft.public.access.queries
buckpeace
external usenet poster
 
Posts: 18
Default date format - datediff - Not working

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.
--
Buck
  #2  
Old April 12th, 2007, 10:20 PM posted to microsoft.public.access.queries
Ofer Cohen
external usenet poster
 
Posts: 1,683
Default date format - datediff - Not working

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\#")

--
Good Luck
BS"D


"buckpeace" wrote:

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.
--
Buck

  #3  
Old April 12th, 2007, 10:59 PM posted to microsoft.public.access.queries
fredg
external usenet poster
 
Posts: 4,386
Default date format - datediff - Not working

On Thu, 12 Apr 2007 13:50:00 -0700, buckpeace wrote:

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.

--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
  #4  
Old April 13th, 2007, 01:10 AM posted to microsoft.public.access.queries
John W. Vinson
external usenet poster
 
Posts: 18,261
Default date format - datediff - Not working

On Thu, 12 Apr 2007 13:50:00 -0700, buckpeace
wrote:

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]
  #5  
Old April 13th, 2007, 01:15 AM posted to microsoft.public.access.queries
John Spencer
external usenet poster
 
Posts: 2,364
Default date format - datediff - Not working

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
'================================================= ===


buckpeace wrote:
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.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 02:49 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.