Microsoft Office Tutorials and References
In Depth Information
Calculating and Formatting Dates
To format a number, display the properties of the text box, and click the All
or Format tab of the property sheet, as shown in Figure 4-1, earlier in this
chapter. For a text box with numeric values, you can click the down arrow at
the right end of the Format property to display a menu of numeric formats.
See Book II, Chapter 1 for details about numeric formats, which are the same
formats that you can use to format the fields in your tables.
Calculating and Formatting Dates
Access includes operators and functions that work on dates, including
finding the number of days between two dates, separating a date into its
components (day, month, year, hour, minute, and second), and adding days to a
date. Book III, Chapter 2 describes the operators and functions you can use.
A few examples are in the following table.
Date Expression
Purpose
=DateDiff(“w”, [OrderDate],
[ShipDate])
Number of weeks between ordering
and shipping
=[InvoiceDate] + 30
30 days after the invoice date
=Date() + 10
10 days after today
Quarter in which order was placed
=DatePart(“q”, [OrderDate])
Access gives you lots of date formats to choose among, as listed in Book II,
Chapter 1. You set them in the Format property on the Format (or All) tab
of the property sheet.
Calculating and Formatting Text
For forms and reports, you want things to look just right, and text expressions
allow you to do all kinds of things to slice and dice the text that appears in
your text boxes. Book III, Chapter 2 describes the operators and functions you
can use with text values. A few examples are in the following table.
Text Expression
Purpose
First and last names, with a space in between
=[FirstName] & “ “ &
[LastName]
=[LastName] & “, “ &
[FirstName]
Last name first, with a comma and space in
between
=UCase([LastName]) Last name, in all capital letters
=Left([ProductCode], 2) First two characters of the product code
Search JabSto ::

Custom Search