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 » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Strange Month and Format results



 
 
Thread Tools Display Modes
  #1  
Old January 2nd, 2010, 05:05 PM posted to microsoft.public.access.reports
tkosel
external usenet poster
 
Posts: 80
Default Strange Month and Format results

I have a report where I need to change a label caption depending on
conditions. I have done this in the past. However, I am getting strange
results and don't know why. Strange results from immediate window below.

? Month(Forms!frmCertifedVendorForm.ReportEndDate)
12
? Format(Month(Forms!frmCertifedVendorForm.ReportEnd Date), "mmm")
Jan

How can the 12th month format as Jan? Am I stupid?
  #2  
Old January 2nd, 2010, 05:30 PM posted to microsoft.public.access.reports
Gina Whipp
external usenet poster
 
Posts: 3,500
Default Strange Month and Format results

tkosel,

I imagine all the months will say *Jan* because you can't use the Month
Function like that. It will always return a numeric variable. Try...

Format(Forms!frmCertifedVendorForm.ReportEndDate, "mmm")


--
Gina Whipp
2010 Microsoft MVP (Access)

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

"tkosel" wrote in message
news
I have a report where I need to change a label caption depending on
conditions. I have done this in the past. However, I am getting strange
results and don't know why. Strange results from immediate window below.

? Month(Forms!frmCertifedVendorForm.ReportEndDate)
12
? Format(Month(Forms!frmCertifedVendorForm.ReportEnd Date), "mmm")
Jan

How can the 12th month format as Jan? Am I stupid?



  #3  
Old January 2nd, 2010, 05:51 PM posted to microsoft.public.access.reports
fredg
external usenet poster
 
Posts: 4,386
Default Strange Month and Format results

On Sat, 2 Jan 2010 09:05:01 -0800, tkosel wrote:

I have a report where I need to change a label caption depending on
conditions. I have done this in the past. However, I am getting strange
results and don't know why. Strange results from immediate window below.

? Month(Forms!frmCertifedVendorForm.ReportEndDate)
12
? Format(Month(Forms!frmCertifedVendorForm.ReportEnd Date), "mmm")
Jan

How can the 12th month format as Jan? Am I stupid?


Perhaps a better understanding of how Access stores and processes
dates might help.

Access stores and processes Date values as the count of the number of
days since 12/30/1899.
Today's date (1/1/2010) would be stored as 40180.

Let's assume the date value in [ReportEndDate] is 12/20/2009.

Therefore
Month([ReportEndDate]) returns 12 (the 12th month ... December).
So substituting the value of Month([ReportEndDate]) in the your next
expression you have

Format(12,"mmm") which will correctly the 1st month, January.
Why? Your expression is formatting the number 12 (meaning +12 days
from 12/30/1899) which, as a date, is 1/11/1900.

So:
Format(#1/11/1900#,"mmm") does indeed return Jan.

The simplest method to return the Month as a word value is to just
use:
Format(Forms!frmCertifedVendorForm.ReportEndDate," mmm")

I hope this helps.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
 




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 07:36 AM.


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