Solved

Access 2003: Convert date into text

Posted on 2006-06-28
6
224 Views
Last Modified: 2012-06-27
Hi:
I have a field called [ShortDate] which reads a year and month as:  "2006 06" for 2006 June.  I would like to make another field from this one that reads: "2006 June".  I imagine that an amendment to the following query would be easiest.

SELECT tblTFILE_New_TFILE_DateA60504_Converted.KEY, tblTFILE_New_TFILE_DateA60504_Converted.DEPT, tblTFILE_New_TFILE_DateA60504_Converted.REC, tblTFILE_New_TFILE_DateA60504_Converted.NAME, tblTFILE_New_TFILE_DateA60504_Converted.CODE, tblTFILE_New_TFILE_DateA60504_Converted.FDATE_Converted, tblTFILE_New_TFILE_DateA60504_Converted.FDATE, tblTFILE_New_TFILE_DateA60504_Converted.DESC, tblTFILE_New_TFILE_DateA60504_Converted.OP_ID, tblTFILE_New_TFILE_DateA60504_Converted.ShortDate INTO tblTeam3APPOsByOperator
FROM tblTFILE_New_TFILE_DateA60504_Converted
WHERE (((tblTFILE_New_TFILE_DateA60504_Converted.OP_ID) Like "RM" Or (tblTFILE_New_TFILE_DateA60504_Converted.OP_ID) Like "CD" Or (tblTFILE_New_TFILE_DateA60504_Converted.OP_ID) Like "NC"));

Thanks!

Charlie
0
Comment
Question by:cepes
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
6 Comments
 
LVL 65

Expert Comment

by:rockiroads
ID: 17000812
format your date field like this

Format([datefld],"YYYY MMMM")

0
 
LVL 65

Expert Comment

by:rockiroads
ID: 17000827
which field is it u want
0
 
LVL 61

Accepted Solution

by:
mbizup earned 500 total points
ID: 17000890
It sounds like [ShortDate ] is a string and not a date type?  Give this a try...

SELECT tblTFILE_New_TFILE_DateA60504_Converted.KEY, tblTFILE_New_TFILE_DateA60504_Converted.DEPT, tblTFILE_New_TFILE_DateA60504_Converted.REC, tblTFILE_New_TFILE_DateA60504_Converted.NAME, tblTFILE_New_TFILE_DateA60504_Converted.CODE, tblTFILE_New_TFILE_DateA60504_Converted.FDATE_Converted, tblTFILE_New_TFILE_DateA60504_Converted.FDATE, tblTFILE_New_TFILE_DateA60504_Converted.DESC, tblTFILE_New_TFILE_DateA60504_Converted.OP_ID, tblTFILE_New_TFILE_DateA60504_Converted.ShortDate,
Left( tblTFILE_New_TFILE_DateA60504_Converted.ShortDate,4) & " "  & MonthName( Right(tblTFILE_New_TFILE_DateA60504_Converted.ShortDate,2))  As FormattedShortDate
 INTO tblTeam3APPOsByOperator
FROM tblTFILE_New_TFILE_DateA60504_Converted
WHERE (((tblTFILE_New_TFILE_DateA60504_Converted.OP_ID) Like "RM" Or (tblTFILE_New_TFILE_DateA60504_Converted.OP_ID) Like "CD" Or (tblTFILE_New_TFILE_DateA60504_Converted.OP_ID) Like "NC"));


I added this:
Left( tblTFILE_New_TFILE_DateA60504_Converted.ShortDate,4) & " "  & MonthName( Right(tblTFILE_New_TFILE_DateA60504_Converted.ShortDate,2))  As FormattedShortDate

to convert formats like 2006 06 to 2006 June
0
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 

Author Comment

by:cepes
ID: 17000892
[ShortDate]
0
 

Author Comment

by:cepes
ID: 17000901
Sorry... just thought of another issue...  If I change to "2006 June" formatting, I lose the sort sequence order of having 2006 06...  I suppose I could sort by ShortDate and make it not visible in the report...

Charlie
0
 
LVL 61

Expert Comment

by:mbizup
ID: 17001164
That would be the best way to go... simpler than working out a sort  on 2006 June etc.
0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question