=========
QUESTION
———
How do I format numbers, dates, etc in my VBA code?
=========
ANSWER
———
see EXAMPLES
=========
EXAMPLES
——— Format(rs!Store, "0000")
Formats a number field that may contain only one digit (i.e. 2) to four digits with leading zeros (i.e. 0002)
———= Format(Now(), "hh:mm AMPM")
If the current time is 5:04:23 in the afternoon, the expression returns 05:04 PM.
———= Format(Now(), "Long Time")
Returns current time in the system-defined long time format.
——— Format(Date, "yyyy-mm-dd")
Returns: 2011-04-25
——— =Format(Now(),"mm/dd/yyyy hh:nn ampm")
Returns: 04/15/2011 10:04 AM
——— Format(Date(),"mmmm d"", ""yyyy")
Returns: June 16, 2007
——— Format(Date(),"Long Date")
Returns: Thursday, June 16, 2007
———
Format(xxx, “Currency”)
–shows with two decimal places
Format(xxx, “$#,##0;($#,##0)”)
–Shows with no decimal places
–Puts negatives in parantheses
Format(xxx, “$#,##0″)
–Shows with no decimal places
–no change for negatives
=========
APPLIES TO / KEY WORDS
———
VBA
Format()
Format Function
=========
REF
———
http://www.your-save-time-and-improve-quality-technologies-online-resource.com/vba-format-command.html
http://www.techonthenet.com/excel/formulas/format_number.php
—
http://www.anysitesupport.com/vba-format-function/
http://anySiteHosting.com