I'd like my delete warning back. I don't know where it went.

D

Don

My delete button just deletes the records with no warning. How do I get
it back? The event for my button is:
Private Sub DeleteButton_Click()
DoCmd.SetWarnings True
On Error GoTo Err_DeleteButton_Click


DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70

Exit_DeleteButton_Click:
Exit Sub

Err_DeleteButton_Click:
MsgBox Err.Description
Resume Exit_DeleteButton_Click

End Sub
 
D

Darrell Childress

Most likely, you have inadvertently turned off the confirmation. To get
it back, go to
Tools
Options
Edit/Find tab
In the "Confirm" section, make sure "Record changes" is checked.
 
P

Pat Hartman\(MVP\)

Do you know what menu item 8 was on the edit menu of Access 95? Well,
neither do I. I'm going to guess that it selects the current record and
that menu item 6 deletes it. Convert these to the modern equivalents.
DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdDeleteRecord

To turn your warnings back on, go to Tools/Options - Edit/Find - Check all
the confirm options.
 
D

Don

Thanks for the reply. I made the changes to my event. However, all
confirm options are still checked. Still no warning. I copied the code
for a delete button in another database and pasted into this database.
Still no warning. I tried creating a new delete button. Still no
warning. I just don't get it.
 
A

Allen Browne

3 places to look:
- SetWarnings is still off. (Most common.)
- You have code in the form's BeforeDelConfirm event that suppresses the
warning mesage.
- The confirm options you have already been pointed to.

Here's a way to delete a record without any confirmation message, regardless
of any of those settings:

Private Sub DeleteButton_Click()
If Me.Dirty Then
Me.Undo
End If
If Not Me.NewRecord Then
With Me.RecordsetClone
.Bookmark = Me.Bookmark
.Delete
End With
End If
End Sub
 
D

Don

Thank you for your reply. I just noticed that I don't get a delete
warning even when I'm deleting the record from the Edit menu. I've
checked my confirm options and they are still checked.
 
J

Joan Wild

Then Allen's first suggestion is likely.

Hit Ctrl-G and type
DoCmd.SetWarnings True
 
D

Don

Thanks for the reply. Unfortunately, I had no luck. It's weird because
my other tables and forms offer a confirmation message on delete but
not this form. So, I'm thinking it has to be in the code. But, prior to
this thread I hadn't used DoCmd.SetWarnings at all or played with the
confirmation checkboxes.

Can anybody help me make a customized MsgBox that popups on delete?
Perhaps that's my only way out.
 
D

Don

Could the fact that this form is my only form with a subform make a
difference. I saw in another post that if a form is set to be a popup
and modal then the delete confirmation will not fire. So, I made sure
that neither form was set to popup or modal. Are there any other
property settings that might cause this?
 
J

Joan Wild

I cannot think of any. Double check the code on this form. Is this form
opened from another form - if so check its code.
 
D

Don

Does anyone have the time to check this out if I emailed a copy of my
database? It's really bugging me.

Don
 
P

pietlinden

Did you try running

docmd.setwarnings TRUE

somewhere? Does that fix it?

(Allen's solution #1)
 
D

Don

I know it's been a few days. Is your offer still good? If so, can I get
your email address?
 

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