Inserting the current time or date in any field

Top  Previous  Next

This example demonstrates:

®Inserting a date or time value in any field

Application notes:

®Works for dates, times, or date-and-time values
®Works in any field, including header fields
®Works in all FullSpeed compatible applications
 

This example builds on ideas from the Tutorial and application-specific examples in this Help system.

Inserting a Date or Time in Any Field

This topic shows how to insert a date or time value in any field of a FullSpeed-compatible application.

Inserting the current time

Let's set up a macro that will (1) insert the current time into the currently focused field of the target application, then (2) automatically move to the next field (to make data entry faster, requiring fewer keystrokes). This is one of the simplest macros possible, easy to set up, and quick to use.

Getting Ready

Set up the macro worksheet with one formula

All you need is a single formula that returns the current date and time. Mark the formula cell as the Begin field, and mark the next cell to the right as the End field. That will move to the next field in the target application after the time has been written, when the macro runs.

Notes:

®The =NOW() function returns a datetime value. It must be formatted as shown below before you will recognize it as normal date or time information.

Format the formula cell

Right-click the formula cell and select Format cell from the popup menu. Then select a format from the list of date, time, and date-time formats:

Assign a hotkey

Because you may use this macro often, assigning it an easily remembered hotkey is important. Shift+Ctrl+T would be a good choice:

Running the Macro

1.Click in the field where you want the time inserted, like this custom field in a QuickBooks sales receipt:

2.Press the hotkey you assigned to the macro.

 Notice that after writing the current time the macro moved the focus to the next field, where it is ready for entry of the customer's phone number—this was caused by selecting an End field as described above.

Insert the date or time when a macro processes the whole form

This same technique works in macros designed for processing entire forms—i.e., all of the detail lines on a form. (Usually these macros will have the Repeat until "X" blank fields repeat type.)

®To insert the date or time in a line item field, just use the =NOW() function in the desired column (usually, it will be on a text-triggered formula row).
®To insert the date or time in a header field, use the approach described in the Using data from header fields topic. But instead of reading data from a header field you will use the =NOW() formula to write a date or time into the field.