Alert

Fires when before an alert message box that requires user intervention is displayed. You can use this event to replace the built-in message boxes with your own.

Syntax

Sub object_Alert(id As Integer, prompt As String, buttons As Long, result)

The Alert event syntax has the following parts:

Part Description
id Integer - Specifies the alert message id.
prompt String - Specifies the message string to be displayed.
buttons Long - Specifies the number and style of buttons to be displayed.
result Long - used to set the return value of the event when the alert is handled by the event.

Settings

The id parameter has the following settings:

Setting Description
ddARAlertControlNotRegistered 1 - Report contains a control that is not registered on the client machine.
ddARAlertDataSource 2 - Data source returned error when updating property sheet.
ddARAlertDAOSettings 3 - DAO data control settings are incorrect.
ddARAlertDAO 4 - DAO returned error when opening the connection or recordset.
ddARAlertFieldList 5 - A database error occurred when attempting to refresh the field list window.
ddARAlertInvalidSectionForDataControl 6 - A data control cannot be added to a non-detail section.
ddARAlertDataControlAlreadyExists 7 - User tried to drop more than one data control into the detail section.
ddARAlertControlCreateFailed 8 - The ActiveX control can't be hosted in ActiveReports
ddARAlertAB2DLLMissing 9 - AB2DLL.DLL toolbars library is missing.
ddARAlertCantUndoDelete 10 - The edit/delete operation can't be undone
ddARAlertDeleteFailed 11 - The edit/delete operation failed.
ddARAlertEditCutFailed 12 - The edit/cut operation failed.
ddARAlertEditCopyFailed 13 - The edit/copy operation failed.
ddARAlertDuplicateStyleName 14 - User tried to create a style that already exists.
ddAlertCantDeleteStyle 15 - User tried to delete the normal style.
ddAlertRTF 16 - RTF control alert.
ddARAlertRTFDeleteField 17 - Confirm deleting an RTF merge field.
ddARAlertCantDeleteDetailSection 18 - Detail section cannot be deleted.
ddARAlertDeleteSectionPrompt 19 - Confirm deleting a section.
ddARAlertSaveLayoutFailed 20 - Unable to save the report layout.

Example

Private Sub ard_Alert(ByVal id As Integer, ByVal prompt As String, ByVal buttons As Long, result As Variant)
If id = ddARAlertControlNotRegistered Then
MsgBox "Report contains an unregistered control." & _"
"Contact 999-999-9999 with the following information " & _
vbCrlf & Str(id) & " - " & prompt
result = 0
End If
End Sub