Archive for January, 2006

Date Calculations in Access

There are a number of ways to calculate the time between two dates in Access. You can use a calculated field in a query, a calculated control in a form or report, or you can use a VBA procedure to perform the calculation.

If you need to calculate the number of days between two dates, the syntax is:

=[One date field] - [Another date field]

You can use functions to calculate the number of years between two dates:

=Year([One date field]) - Year([Another date field])

You can also use the DateDiff() function, which uses an argument to determine how the time interval is measured.

For example,

=DateDiff("q", Date1, Date2)

returns the number of quarters between the two fields. (In the example above, Date1 would be subtracted from Date2.) The other intervals that can be used in this expression are as follows: “yyyy” – Years, “m” – Months, “y” – Day of Year, “d” – Day, “w” – Weekdays, “ww” – Weeks, “h” – Hours, “n” – Minutes, “s” – Seconds.

Naming Date Fields

When naming date fields in Access, avoid naming a field Date, since this is a built-in Access function. Instead, consider using more descriptive names, such as BeginDate, HireDate, etc.

Hard Coding a Date

When calculating with dates in Access, you can hard-code an arbitrary date by using the following syntax:

#mm/dd/yyyy#

For example, you would use the following code to subtract a date from Jan. 1, 2006:

=#1/1/2006# - [Date Field]

Keyboard Shortcuts in Access

Here are some useful shortcuts for Microsoft Access:

  • Undo typing: CTRL+Z or ALT+BACKSPACE
  • Undo changes: Press ESC once for current field, ESC twice for current record
  • Insert the current date: CTRL+SEMICOLON (;)
  • Insert the current time: CTRL+COLON (:)
  • Insert the default value for a field: CTRL+ALT+SPACEBAR
  • Insert the value from the same field in the previous record: CTRL+APOSTROPHE (‘)
  • Add a new record: CTRL+PLUS SIGN (+)
  • Delete the current record: CTRL+MINUS SIGN (-)
  • Recalculate fields: F9

Save Searches in Outlook

If you find yourself repeating the same searches in Outlook, you can create a custom search, save it, and execute it again by simply re-opening the saved search.

Here’s how:

  1. Open the Advanced Find dialog box (Control+Shift+F, or click the Find button, then selection Advanced Find… from the Options menu.)
  2. Enter your search options (for example, all mail with the word “password” in the message body).
  3. When the search is finished, select File | Save Search…
    Name the search something you’ll recognize later, such as “messageswithpassword.”
    (You might want to create a folder in My Documents called “Outlook Searches.”
  4. Click OK, and close the Advanced Find dialog
  5. Open Advanced Find again.
  6. Select File | Open Search…
  7. Select your saved search, and click OK. Outlook will repeat the search.

Speed Up E-mail in Outlook

If you find that it takes too long to switch from one email message to another, try turning off the Outlook “feature” that displays a Name Smart Tag in the message header and checks the user’s Instant (Windows) Messenger status.

To do so:

  1. Select Tools | Options.
  2. Click the Other tab.
  3. Remove the check from Enable the Person Names Smart Tag. (The Display Messenger Status in the From fieldoption will automatically be disabled if the Names Smart Tag is not available.)
  4. Disable Person Names Smart Tag