double conformation on delete

S

Song

Private Sub cmdDel_Click()
On Error Resume Next
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
If Err = 2501 Then Err.Clear 'user canceled
End Sub

It gives me two confirmation: How to suppress 2nd confirmation?

1. Are you sure you want to delete this record? (when I click Yes, it gives
me following)
2. You are about to delete 1 record(s). If you click Yes, you won't be able
to undo this delete operation. Are you sure you want to delete hese records?

I only want 1st confirmation, not 2nd. Thanks.
 
K

Klatuu

The second confirmation is issued by Access based on Option settings. You
can disable it with the SetWarnings method:

Private Sub cmdDel_Click()
On Error Resume Next
Docmd.SetWarnings False
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
Docmd.SetWarnings True
If Err = 2501 Then Err.Clear 'user canceled
End Sub
 
S

Song

Got it. Thanks.

Klatuu said:
The second confirmation is issued by Access based on Option settings. You
can disable it with the SetWarnings method:

Private Sub cmdDel_Click()
On Error Resume Next
Docmd.SetWarnings False
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
Docmd.SetWarnings True
If Err = 2501 Then Err.Clear 'user canceled
End Sub
 

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

Similar Threads


Top