Pacific Database

Home | Contact | FAQs | View Cart

A world of information at your fingertips

Create & use a formatted message box, like those found in Access 97

You can give your application a touch of class by using the FMsgBox function to create a standard Windows message box with formatted text, just like the one that was available in Access 97.

In Access 97, the call to achieve the following MsgBox would have included the @ sign to separate the 3 lines of text. Like so:

MsgBox "Line1@Line2@Line3"

The facility to use @ directly in later versions was removed, but we can still get at it by wrapping the call to the MsgBox function in an Eval function. That's what the FMsgBox function does.

 

Function signature

Public Function FMsgBox(sLine1 As String, _
                        sLine2 As String, _
                        sLine3 As String, _
                        Optional lButtons As VbMsgBoxStyle = vbOKOnly, _
                        Optional sTitle As String = vbNullString, _
                        Optional HelpFile As Variant, _
                        Optional Context As Variant) _
                As VbMsgBoxResult

Arguments

sLine1 String value specifying the first line of the message.
 
sLine2 String value specifying the second line of the message.
 
sLine3 String value specifying the third line of the message.
 
lButtons vbMsgBoxStyle enum value specifying the buttons to display, the default button, and the icon to be displayed in the text area. These are the standard MsgBox Style options.
 
sTitle String value specifying the text to be displayed in the message box's title bar.
 
HelpFile Optional string value specifying the Help file to use to provide context-sensitive Help for the dialog box. If HelpFile is provided, context must also be provided.
 
Context Optional numeric value specifying the Help context number assigned to the appropriate Help topic by the Help author. If Context is provided, HelpFile must also be provided.
 

Add the code to a standard module.