Avatar of Grasshopper3
Grasshopper3
 asked on

Set Action query warning's

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
Microsoft Access

Avatar of undefined
Last Comment
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)

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
Grasshopper3

ASKER
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.
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)

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
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)

prompts
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)

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
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)

BTW ... you can also do this:

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

CurrentDb.Execute sSQL, dbFailOnError

mx
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Grasshopper3

ASKER
From the attached you can see I have the options set to yes but databse is still deleting, saving without prompts.

Frustrating!
ActionQuery.bmp
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)

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