PC Review


Reply
Thread Tools Rate Thread

Delete button

 
 
Dee
Guest
Posts: n/a
 
      19th May 2010
I used to get a warning message before deleting a record. I no longer get a
message, it just deletes the record immediately upon clicking the delete
button. I know I can manually add code to fix this, but I would like to know
why it stopped working automatically. I am using Access 2007 - the database
was converted from 2003. I tried creating a new form with the delete button
and i do get the warning.
Is there an easy fix for this?
 
Reply With Quote
 
 
 
 
Dirk Goldgar
Guest
Posts: n/a
 
      19th May 2010
"Dee" <(E-Mail Removed)> wrote in message
news:0A5238E9-7734-4EB6-90F7-(E-Mail Removed)...
>I used to get a warning message before deleting a record. I no longer get
>a
> message, it just deletes the record immediately upon clicking the delete
> button. I know I can manually add code to fix this, but I would like to
> know
> why it stopped working automatically. I am using Access 2007 - the
> database
> was converted from 2003. I tried creating a new form with the delete
> button
> and i do get the warning.
> Is there an easy fix for this?



This commonly happens when you have code that turns the warnings off with
the statement "DoCmd.SetWarnings False", without subsequently turning them
on again with "DoCmd.SetWarnings True". People often turn off warnings so
as to execute an action query without a prompt. However, if you omit to
turn them on again, they'll stay off. It is crucial, if you turn off
warnings, that you have good error-handling inplace to ensure that there is
no way the procedure can be exited, even if an error occurs -- without
turning them on again.

--
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html

(please reply to the newsgroup)

 
Reply With Quote
 
Dee
Guest
Posts: n/a
 
      20th May 2010
Thank you for your reply. However, I did not have any code as you mentioned
below that would turn the warnings off. I only used the standard delete
button that is created with the wizard. the odd thing is, it works in some of
the forms, and the code is exactly the same as the ones that dont work.

Private Sub Delete_Record_Click()
On Error GoTo Err_Delete_Record_Click
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
Exit_Delete_Record_Click:
Exit Sub
Err_Delete_Record_Click:
MsgBox Err.Description
Resume Exit_Delete_Record_Click
End Sub

"Dirk Goldgar" wrote:

> "Dee" <(E-Mail Removed)> wrote in message
> news:0A5238E9-7734-4EB6-90F7-(E-Mail Removed)...
> >I used to get a warning message before deleting a record. I no longer get
> >a
> > message, it just deletes the record immediately upon clicking the delete
> > button. I know I can manually add code to fix this, but I would like to
> > know
> > why it stopped working automatically. I am using Access 2007 - the
> > database
> > was converted from 2003. I tried creating a new form with the delete
> > button
> > and i do get the warning.
> > Is there an easy fix for this?

>
>
> This commonly happens when you have code that turns the warnings off with
> the statement "DoCmd.SetWarnings False", without subsequently turning them
> on again with "DoCmd.SetWarnings True". People often turn off warnings so
> as to execute an action query without a prompt. However, if you omit to
> turn them on again, they'll stay off. It is crucial, if you turn off
> warnings, that you have good error-handling inplace to ensure that there is
> no way the procedure can be exited, even if an error occurs -- without
> turning them on again.
>
> --
> Dirk Goldgar, MS Access MVP
> Access tips: www.datagnostics.com/tips.html
>
> (please reply to the newsgroup)
>

 
Reply With Quote
 
Dirk Goldgar
Guest
Posts: n/a
 
      20th May 2010
"Dee" <(E-Mail Removed)> wrote in message
news:1BD1EF7F-9714-459E-A2EA-(E-Mail Removed)...
> Thank you for your reply. However, I did not have any code as you
> mentioned
> below that would turn the warnings off. I only used the standard delete
> button that is created with the wizard. the odd thing is, it works in some
> of
> the forms, and the code is exactly the same as the ones that dont work.
>
> Private Sub Delete_Record_Click()
> On Error GoTo Err_Delete_Record_Click
> DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
> DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
> Exit_Delete_Record_Click:
> Exit Sub
> Err_Delete_Record_Click:
> MsgBox Err.Description
> Resume Exit_Delete_Record_Click
> End Sub


The wizards produce outdated code, but it should still work the same. If
you really don't have any code that turns warnings off, I don't know why you
would get warnings on some forms and not on others.

If you'd like to send me a copy of your database and a list of steps to
reproduce the problem, I'll have a look at it, time permitting. Please be
sure to compact and zip the database to minimize the size. You can send it
to the address derived by removing NO SPAM and ".invalid" from the reply
address of this message. If that address isn't visible to you, you can get
my address from my web site, which is listed in my sig. Do *not* post my
real address in the newsgroup -- I don't want to be buried in spam and
viruses.

--
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html

(please reply to the newsgroup)

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
i can't find my delete button to delete messages in microsoft outl =?Utf-8?B?cmVsbGFzdGF0ZQ==?= Microsoft Outlook Discussion 1 3rd Oct 2007 02:25 AM
delete confirmation on pushing delete button =?Utf-8?B?Y2hpbGw=?= Microsoft Access 5 5th Feb 2007 03:29 PM
my delete button doesn't delete highlighted text =?Utf-8?B?Z3lwc3k=?= Microsoft Word Document Management 2 27th Mar 2006 04:49 AM
How to disable Delete Cookies/Delete Files button =?Utf-8?B?cGFyZGFsNTE=?= Windows XP Security 1 11th Jan 2005 07:12 PM
Delete a custom button by holding down the ALT key and dragging the button off the toolbar Stephen Microsoft Excel Programming 0 4th Apr 2004 02:22 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:00 PM.