Chapter 26: Bulletproofing Access Applications
915
Overlapping Windows
The Overlapping Windows interface has its advantages as well. Because of the variety of
BorderStyle property settings and the ability to remove the Min, Max, and Close buttons on a
form, you have a high degree of control over a user’s access to a form or report. With the
Overlapping Windows interface, you can easily force a user to interact with just one form at a time.
Very often, this is the ideal way to ensure that a user has completed a particular task (such as data
entry) before moving on to another part of the application.
Keeping the user informed
An uninformed user is a dangerous user. Keep the user informed of the database status through the
hourglass mouse cursor, message boxes, status-bar text, and progress meters. A simple progress
meter can keep a user from frustration during long queries or printouts. The last thing you want a
user doing is hitting keys in a panic, thinking the application has crashed or is hung up.
Also, always warn the user when something dangerous (like a Delete query that removes data from
the database) is about to happen. You don’t have to inform users of trivial or expected actions, but
make them aware when irreversible changes are being made.
Getting your message across with a message box
One of the easiest ways to communicate (but sometimes the most annoying to the user) is with the
MsgBox function. Although message boxes are easy to add to applications, they’re always modal
and require the user to acknowledge the message before it’s dismissed. Message boxes can disrupt
the workflow if the user is constantly required to dismiss message boxes containing low-value
information. In fact, flooding a user with silly message boxes containing unimportant information
may cause a user to ignore truly important messages.
On the other hand, in many situations, message boxes are invaluable. A message box can be used
to obtain confirmation before performing an irreversible action or to deliver important information.
The MsgBox function accepts a number of parameters that specify the message text, which buttons
to display on the message box, and the text to display in the message-box title bar. The MsgBox
function returns a value indicating which button displayed on the message box has been clicked by
the user. The syntax of MsgBox is as follows:
MsgBox(Prompt[, Buttons][, Title][, HelpFile, Context])
where the function parameters are
l (^) Prompt: The message displayed in the message box. Prompt can be a maximum of
approximately 1,024 characters. Separate lines in Prompt with a carriage return character
(Chr(13)), a linefeed character (Chr(10)), or a carriage return/linefeed character com-
bination (Chr(13) & Chr(10)) between the lines. (Access provides the vbCrLf intrin-
sic constant that combines both a carriage return and a line feed, as well as a vbNewLine
intrinsic constants.)