Yes/No Message

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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" έγγÏαψε:
 
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
 
Back
Top