Microsoft KB Archive/106290: Difference between revisions

From BetaArchive Wiki
(importing KB archive)
 
m (Text replacement - """ to """)
 
Line 76: Line 76:
The following sample function returns January instead of April:<br />
The following sample function returns January instead of April:<br />


<pre class="fixed_text">  =Format$(Month(#4/30/93#), &quot;mmmm&quot;)
<pre class="fixed_text">  =Format$(Month(#4/30/93#), "mmmm")
                 </pre>
                 </pre>
<br />
<br />
To return just the name of the month, use the Format() function without the Month() function. For example, the following expression returns April:<br />
To return just the name of the month, use the Format() function without the Month() function. For example, the following expression returns April:<br />


<pre class="fixed_text">  =Format(#4/30/93#,&quot;mmmm&quot;)
<pre class="fixed_text">  =Format(#4/30/93#,"mmmm")
                 </pre>
                 </pre>
<br />
<br />
Line 88: Line 88:
NOTE: In the following example, an underscore (_) is used as a line- continuation character. Remove the underscore from the end of the line when re-creating the example.<br />
NOTE: In the following example, an underscore (_) is used as a line- continuation character. Remove the underscore from the end of the line when re-creating the example.<br />


<pre class="fixed_text">  =Choose(Month([datefield]),&quot;January&quot;,&quot;February&quot;,&quot;March&quot;,&quot;April&quot;, _
<pre class="fixed_text">  =Choose(Month([datefield]),"January","February","March","April", _


       &quot;May&quot;,&quot;June&quot;,&quot;July&quot;,&quot;August&quot;,&quot;September&quot;,&quot;October&quot;,&quot;November&quot;, _
       "May","June","July","August","September","October","November", _
       &quot;December&quot;)
       "December")
                 </pre>
                 </pre>
<br />
<br />
Line 102: Line 102:
== REFERENCES ==
== REFERENCES ==


For information about syntax and usage of the Choose function, search the Help Index for &quot;Choose function.&quot;
For information about syntax and usage of the Choose function, search the Help Index for "Choose function."


</div>
</div>

Latest revision as of 09:01, 20 July 2020

Knowledge Base


Article ID: 106290

Article Last Modified on 1/18/2007



APPLIES TO

  • Microsoft Access 1.0 Standard Edition
  • Microsoft Access 1.1 Standard Edition
  • Microsoft Access 2.0 Standard Edition
  • Microsoft Access 95 Standard Edition
  • Microsoft Access 97 Standard Edition



This article was previously published under Q106290

Moderate: Requires basic macro, coding, and interoperability skills.

SYMPTOMS

If you use the Format() function on the result of a Month() function, Microsoft Access returns an incorrect result.

CAUSE

The Month() function converts a date to an integer. The Format() function is expecting a date serial number as an argument, but instead receives an integer.

STATUS

This behavior is by design.

MORE INFORMATION

The following sample function returns January instead of April:

   =Format$(Month(#4/30/93#), "mmmm")
                


To return just the name of the month, use the Format() function without the Month() function. For example, the following expression returns April:

   =Format(#4/30/93#,"mmmm")
                


If the Month() function is required, use the Choose() function to return the name of the month. The following example demonstrates how to use the Choose() function:

NOTE: In the following example, an underscore (_) is used as a line- continuation character. Remove the underscore from the end of the line when re-creating the example.

   =Choose(Month([datefield]),"January","February","March","April", _

       "May","June","July","August","September","October","November", _
       "December")
                




REFERENCES

For information about syntax and usage of the Choose function, search the Help Index for "Choose function."

Keywords: kbprb KB106290