This code can be adapted and put into your own projects. You ask the user a question about a condition in your program, and the user may click YES or NO in response to what your question was. Additional example of code for this function is given in the VB6 Language Reference. I used the following code in cmdExit when the user was going to clear the data out of the text boxes before doing a calculate event...
If (condition [the one you want to ask user about]) Then
Dim Msg, Style, Title, Response
Msg = "Do you want to clear the information?"
Style = "vbYesNo + vbQuestion + vbDefaultButton2 [or it can be 1]
Title = "You are about to clear data..."
Response = MsgBox(Msg,Style,Title)
If Response = vbYes Then
[do the Yes code]
ElseIf Response = vbNo Then
[do the No code]
[I placed the regular Clear event steps here]
Now, I stress that this is a very simplified example. There are additional parameters that can be dimensioned for helpfile and context; also there are more choices for style. Refer to Microsoft's VB6 Language Reference, in either the hardcopy or online versions. The online VB6 Language Reference is still a part of the MSDN Library at Microsoft.com.