Chapter 26: Bulletproofing Access Applications
905
Access status bar or in a designated message area on a form. The code required to display a mes-
sage stored in this table is quite simple:
Public Function DisplayMessage(iMsgNumber As Long)
Dim sMsg As String
Dim sSQL As String
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb()
sSQL = “SELECT * FROM tblMessages “ _
& “WHERE MessageID = “ & iMsgNumber & “;”
Set rs = db.OpenRecordset(sSQL)
MsgBox rs(“Message”), vbInformation, “Helpful Hint”
End Function
The beauty of this little messaging system is that you could easily add a form to the application that
permits users to add to the message list or change the existing text messages. Because the
MessageID field is an AutoNumber, new messages are sequentially numbered without dealing
with primary-key collisions. You’ll also have to provide a form that sets a control or form’s Tag
property whenever a new message has been added to the database.
With a bit more work, you could provide each string in multiple languages. Each row would
include the message in a different language (English, Spanish, French, and so on), and the SQL
statement used to extract the message would indicate which language to use:
sSQL = “SELECT * FROM tblMessages “ _
& “WHERE MessageID = “ & iMsgNumber & “ “ _
& “AND Language = “ & LanguageCode & “;”
You could extend the messaging concept a bit and provide multiple levels of help. For example, a
novice user receives more extensive help than a more experienced user, while an expert should be
able to turn off help completely.
What they want
The people using your applications have a number of basic needs that must be met. The applica-
tions you produce are expected to save time and/or money, produce new business, replace obsolete
paper methods, reduce staffing requirements, or improve data reliability. Your applications may be
expected to meet several or all of these objectives. Whatever the situation, you should have a firm
understanding of what your users need. The better you understand the client’s goals, the more you
can concentrate on the aspects of the application that are critical to users.
Getting the application to the users
Once the application has been developed, you have to get a copy of that application to each of the
users who require it. Because the application you developed requires a copy of Microsoft Access to
be installed on each user’s computer (as well as any ActiveX controls that you may be using), it
may not be as easy as simply giving each user a copy of the .accdb (or .accde) file.