?
Solved

DoCmd.SetWarnings False doesn't prevent Action Query prompts

Posted on 2006-04-25
10
Medium Priority
?
378 Views
Last Modified: 2008-02-01
I have a little bit of code which ran perfectly in Access 2000 but when it's run in 2002/3 it throws up a prompt for every append the query makes to the table

    DoCmd.SetWarnings False
    mySQL = "DELETE * FROM table_name"
    DoCmd.RunSQL mySQL
    DoCmd.OpenQuery "query_name", acNormal, acEdit
    DoCmd.SetWarnings True

Am I missing something, it blocks all the other warnings, just not the append. Alternatively, is there any way of turning the Access program Action queries option on and off programatically?
0
Comment
Question by:pwwood
10 Comments
 
LVL 66

Assisted Solution

by:Jim Horn
Jim Horn earned 249 total points
ID: 16534840
(Very wild guess)  In Tools:References, check the 'Microsoft ActiveX Data Objects Library' reference, then try to code it this way...

Dim cn as ADODB.Connection
Set cn = CurrentProject.Connection

DoCmd.SetWarnings False
mySQL = "DELETE * FROM table_name"
cn.Execute mySQL

cn.Execute "query_name", acNormal, acEdit   '<--- By the way, is this an action query, or a select?

DoCmd.SetWarnings True
0
 
LVL 46

Expert Comment

by:tbsgadi
ID: 16534858
Try just DoCmd.OpenQuery "query_name"
0
 
LVL 46

Expert Comment

by:tbsgadi
ID: 16534859
Try just DoCmd.OpenQuery "query_name"
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 46

Accepted Solution

by:
tbsgadi earned 252 total points
ID: 16534881
They replaced acNormal with acViewNormal
0
 
LVL 46

Expert Comment

by:tbsgadi
ID: 16534882
They replaced acNormal with acViewNormal
0
 
LVL 46

Expert Comment

by:tbsgadi
ID: 16534895
I don't know why everything's coming out twice!
0
 
LVL 46

Expert Comment

by:tbsgadi
ID: 16534900
Almost everything!
0
 
LVL 34

Assisted Solution

by:flavo
flavo earned 249 total points
ID: 16534950
open query_name.  Now eye ball it.. Sounds like you have a field name spelt incorrectly.  

I assume the prompt is asking for a field, this field is the one that is incorrect.
0
 

Author Comment

by:pwwood
ID: 16535390
This is sooo embarrassing. The error wasn't with this bit of code, it was further down the module where I was copying from one table to another. However as all your comments forced me to look at the code again in a different way, you all helped. I gave tbsgadi the extra point for posting so many times :o)
0
 
LVL 34

Expert Comment

by:flavo
ID: 16535420
LOL.. Glad you got it working.

Good luck with the rest of your project(s)

Dave
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

840 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