Solved

Access 2003: Convert date into text

Posted on 2006-06-28
6
206 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
  • 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
Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

 

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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …

708 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now