‘This tutorial pop-up a message to user to confirm. Here’s the code
Private Sub Command1_Click()
Dim myValue As String
myValue = MsgBox(“Are your sure you want to delete this file?”, vbQuestion + vbYesNo, “Confirm Delete”)
If myValue = vbNo Then Exit Sub ‘ Do nothing
‘—- Do some codes here to delete record in database
End Sub
Parameters
- Prompt
- Required.String expression displayed as the message in the dialog box. The maximum length ofPromptis approximately 1024 characters, depending on the width of the characters used. IfPromptconsists of more than one line, you can separate the lines using a carriage return character (Chr(13)), a line feed character (Chr(10)), or a carriage return/linefeed character combination (Chr(13) &Chr(10)) between each line.
- Buttons
- Optional. Numeric expression that is the sum of values specifying the number and type of buttons to display, the icon style to use, the identity of the default button, and the modality of the message box. If you omitButtons, the default value is zero.
- Title
- Optional.String expression displayed in the title bar of the dialog box. If you omitTitle, the application name is placed in the title bar.