Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

format date to show month name only 1

Status
Not open for further replies.

cdck

Programmer
Nov 25, 2003
281
US
I have a report that pulls data through queries based on the date the report is opened. The queries look at today's date and then pull data from the month before the current month.

On the report, I want it to state which month of which year the report covers. I had used the following in a field:

[tt]
="WIP Report - SO Summaries - Month of " & MonthName(Month(Date())-1) & ", " & Year(Date())
[/tt]

When I run this report in Access 2003, it works fine. However, older versions of Access don't understand the MonthName function, and the result is that the user thinks they are selecting a month as they open the report, because it asks for them to define it, and then the field comes up with an error.

I am told that the format function with dates should work, but I can only find a way to have it print the entire date with the month spelled out (November 7, 1772, for instance). I only want it to state the month and the year (November of 2007, for instance).

How can I accomplish this with a function that will work even with older versions of Access?


Cheryl dc Kern
 



hi,
Code:
="WIP Report - SO Summaries - Month of " & FORMAT(DateSerial(year(Date()),month(date())-1,day(date())), "mmmm yyyy")


Skip,
[sub]
[glasses] When a diminutive clarvoyant had disappeared from detention, headlines read...
Small Medium at Large[tongue][/sub]
 
Thank you, that works!

Cheryl dc Kern
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top