Solved

Set Action query warning's

Posted on 2012-03-12
9
390 Views
Last Modified: 2012-03-28
Hi,

I have several action queries in a database which, when run, perform the action without prompting me to confirm action. The absence of a warning also applies to modifications to select queries, ie if I close down a select query which I have slightly modified to test syntax, it automatically saves select query changes without prompting me.

I have checked in the Database option tab and the "confirm action queries" tick box is checked.  I have also run simple macro to Set systems Warnings to yes.

However  database is still performing action queries without prompt.

ANy suggestions appreciated
0
Comment
Question by:Grasshopper3
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 2
9 Comments
 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) earned 90 total points
ID: 37712695
Forget SetWarnings ... for exactly the reason (and others) you've discovered.

With CurrentDB
     .Execute "YourActionQueryName1", dbFailOnError
     .Execute "YourActionQueryName2", dbFailOnError
     .Execute "YourActionQueryName3", dbFailOnError
       ' more
End With
0
 
LVL 75
ID: 37712697
With this much safer approach, no prompt.  BUT, should an error occur - the kind you WANT to know about - it will be exposed because of the dbFailOnError ... which you can then process in your error handling routine,

mx
0
 

Author Comment

by:Grasshopper3
ID: 37712713
Will this set the "Prompts" back on for all changes modification, not just the queries named in code?  What i want to do is change database properties so that I am prompted to confirm all action query actions or simple changes to select queries on deleteing tables etc.

if I do the above do i not have to type in all action queries in database (I have several hundred in database) into the code? Will this cover simple changes to select queries which, when I close a query I don't want saved.

At the moment I/other users can do this without confirming deletions etc.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 75
ID: 37712721
This is unrelated to any prompts or SetWarnings ... that's the good news, and there is no bad news.

See your prompts in the Options to Yes ... then you will be prompted for saving changes, deleting, etc ... the things you want to be prompted for.

Trust me ...

mx
0
 
LVL 75
ID: 37712723
prompts
0
 
LVL 75
ID: 37712727
In other words, the Execute method is the BEST of all worlds ...

SetWarnings should be removed from Access as I see it.  But in Macros (forgot those also), it's the only choice you have to avoid the annoying prompts.

mx
0
 
LVL 75
ID: 37712729
BTW ... you can also do this:

Dim sSQL as String
sSQL = <SomeActionSqlString>   ' delete, update, insert or makeTable

CurrentDb.Execute sSQL, dbFailOnError

mx
0
 

Author Comment

by:Grasshopper3
ID: 37712778
From the attached you can see I have the options set to yes but databse is still deleting, saving without prompts.

Frustrating!
ActionQuery.bmp
0
 
LVL 75
ID: 37712916
Open the vba Immediate Window and enter this:

DoCmd.SetWarnings True

and hit Enter.

OR ... reboot your system.  Sounds like there was a SetWarnings False w/o a SetWarnings True

mx
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question