I no longer get asked to confirm deletion of a record.

  • Thread starter Thread starter TerryB
  • Start date Start date
T

TerryB

Up until a few days ago, when I tried to delete a record, a box would pop up,
asking me if I was sure I wanted to delete the record. Now it just deletes
the record without asking me! How do I get the question back?
 
Sorry, I should have said that I checked that first and the 3 confirm message
boxes are all still checked. That's what puzzles me.
 
Sorry, I should have said that I checked that first and the 3 confirm message
boxes are all still checked. That's what puzzles me.

Then I would guess that you have some code running that has:
DoCmd.SetWarnings False
somewhere and you have neglected (or the code errors out before this
point) to set
DoCmd.SetWarnings True

Search your code for SetWarnings False and make sure for each False
there is a corresponding SetWarnings True value that the code will
always read, even if there is an error.
 
Like Fred and Linq, I suspect that Access has turned off the warnings.

Even if you revisit your code and ensure that there's a .SetWarnings True in
place, you may never be able to prevent Access from failing (users sometimes
pull out power plugs!) before that line of code executed.

In addition to cleaning up your code, consider adding a macro to turn
Warnings on. Then, if you discover Access isn't warning, you just run that
macro.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
fredg said:
Then I would guess that you have some code running that has:
DoCmd.SetWarnings False
somewhere and you have neglected (or the code errors out before this
point) to set
DoCmd.SetWarnings True

Search your code for SetWarnings False and make sure for each False
there is a corresponding SetWarnings True value that the code will
always read, even if there is an error.

I respectfully disagree. Using DAO's currentdb.execute or ADO's
CurrentProject.Connection.Execute means never having to worry about
Setwarnings. And you get to see error messages that the action query
may produce.

I prefer, if DAO, to use Currentdb.Execute strSQL,dbfailonerror
command instead of docmd.runsql. For ADO use
CurrentProject.Connection.Execute strCommand, lngRecordsAffected,
adCmdText

Also performance can be significantly different between the two
methods. One posting stated currentdb.execute took two seconds while
docmd.runsql took eight seconds. As always YMMV.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
 
I agree with Tony's assessment that you should try to avoid using the
DoCmd.SetWarnings if at all possible. The CurrentDb.Execute method is
definitely preferred.

That being said, and as others have pointed out, you probably have either a
spot where you didn't reset the warnings OR you hit an error before the set
warnings true could be reset and didn't have that as the first line in an
error handler in the function, or sub, that used it. So, as mentioned also,
it is easy to create a function that you can place in a standard module:

Private Function ResetWarnings()
DoCmd.SetWarnings True
End Function

And then just go to that function in your VBA window and click the Run
button and it should turn things back on for you. But you should fix things
so that it won't happen again.
--
Bob Larson
Access World Forums Super Moderator
Utter Access VIP
Tutorials at http://www.btabdevelopment.com

__________________________________
 
Back
Top