• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 384
  • Last Modified:

DoCmd.SetWarnings False doesn't prevent Action Query prompts

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
pwwood
Asked:
pwwood
3 Solutions
 
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
(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
 
tbsgadiCommented:
Try just DoCmd.OpenQuery "query_name"
0
 
tbsgadiCommented:
Try just DoCmd.OpenQuery "query_name"
0
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

 
tbsgadiCommented:
They replaced acNormal with acViewNormal
0
 
tbsgadiCommented:
They replaced acNormal with acViewNormal
0
 
tbsgadiCommented:
I don't know why everything's coming out twice!
0
 
tbsgadiCommented:
Almost everything!
0
 
flavoCommented:
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
 
pwwoodAuthor Commented:
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
 
flavoCommented:
LOL.. Glad you got it working.

Good luck with the rest of your project(s)

Dave
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now