Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set Warnings Off 1

Status
Not open for further replies.

hirenJ

Programmer
Dec 17, 2001
72
GB
Hi all,

I have a procedure that executes a number (no more than 3) access queries when the user clicks a button --

before the queries are executed I turn off the system messages -- i.e DoCmd.setwarnings False

during the execution of the queries, there are instances where error messages may pop-up with key violations --
How will these be handled with setwarnings off?

Is there a way of ensuring that at these points the queries continue regardlessly of key violations etc...


Hj

:eek:)


 
Instead of executing the queries directly you can use CurrentDb.Execute method. Let me know if you need help using the SQL for your existing queries dynamically.
 
That sounds great -- However, the user creates the queries using the access query design view -- I think the queries are too complex to feed through values from a front-end...

However... I do have another SQL query that is created and executed dynamically , im losing sleep over the syntax of the SQL string.. could you help?>?!!


thanks

Hj
:eek:)
 
As long as you are coding the VBA as to which action queries and when to execute. You can use this sub, just pass in the name of the query you want to run and it'll run it without popping confirmation boxes...

Sub ExecuteQuery(qryQuery As QueryDef)

CurrentDb.Execute qryQuery.SQL

End Sub

Also I forgot about doing it this way, Just add this code to the top of your sub-routine....

SetOption "Confirm Action Queries", False

Sure can you post the code for the other SQL?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top