Yes/No Message

I

iis

Hello everyone,I hope someone help me on this.

I have entered a button on a form for dublicate record that contains this
code.I need to put an extention that displays a yes/no message and if answer
is yes proceed in dublicate record action.I need exactly what to put because
i am new to this.


Thanks


Private Sub Command157_Click()
On Error GoTo Err_Command157_Click


DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 2, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 5, , acMenuVer70 'Paste Append

Exit_Command157_Click:
Exit Sub

Err_Command157_Click:
MsgBox Err.Description
Resume Exit_Command157_Click

End Sub
 
G

George

Dear iis,

Try the following:

If MsgBox("Your question here?", vbYesNo) _
= vbYes Then
DoCmd....
docmd....
docmd...
Else
MMsgBox "You have cancelled...."
End If

Hope this helps,

George

Ο χÏήστης "iis" έγγÏαψε:
 
I

iis

Hi George
I changed my code into:

Private Sub Command157_Click()
On Error GoTo Err_Command157_Click
If MsgBox("Your question here?", vbYesNo) _
= vbYes Then

DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 2, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 5, , acMenuVer70 'Paste Append
Else
MMsgBox "You have cancelled...."
End If
Exit_Command157_Click:
Exit Sub

Err_Command157_Click:
MsgBox Err.Description
Resume Exit_Command157_Click

End Sub



However I get an error message ...not defined.
Have I done something wrong?
Thanks a lot
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top