PC Review


Reply
Thread Tools Rate Thread

DoCmd.OpenQuery

 
 
Michael Kintner
Guest
Posts: n/a
 
      7th Nov 2007
How can I use DoCmd.OpenQuery and not have it prompt that it is performing a
append or delete. I would like it to perform the operation without giving
me the warnings and just do it.

Example in use within Access VB:
DoCmd.OpenQuery "qry-append-BuildMonthlyUsage"
DoCmd.OpenReport "rpt-ShowMonthlyUsage", acViewPreview

Or is there another method that I should be using?

Thank you in advance for your help,
Michael Kintner



 
Reply With Quote
 
 
 
 
fredg
Guest
Posts: n/a
 
      7th Nov 2007
On Wed, 7 Nov 2007 15:23:25 -0500, Michael Kintner wrote:

> How can I use DoCmd.OpenQuery and not have it prompt that it is performing a
> append or delete. I would like it to perform the operation without giving
> me the warnings and just do it.
>
> Example in use within Access VB:
> DoCmd.OpenQuery "qry-append-BuildMonthlyUsage"
> DoCmd.OpenReport "rpt-ShowMonthlyUsage", acViewPreview
>
> Or is there another method that I should be using?
>
> Thank you in advance for your help,
> Michael Kintner


DoCmd.SetWarnings False
DoCmd.OpenQuery "qry-append-BuildMonthlyUsage"
DoCmd.SetWarnings True
DoCmd.OpenReport "rpt-ShowMonthlyUsage", acViewPreview


An alternative method can be used without the need to set warnings.

CurrentDb.Execute "qry-append-BuildMonthlyUsage", dbFailOnError
DoCmd.OpenReport "rpt-ShowMonthlyUsage", acViewPreview

--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
 
Reply With Quote
 
Shiller
Guest
Posts: n/a
 
      7th Nov 2007
On Nov 7, 3:23 pm, "Michael Kintner" <michaelkint...@nospam.com>
wrote:
> How can I use DoCmd.OpenQuery and not have it prompt that it is performing a
> append or delete. I would like it to perform the operation without giving
> me the warnings and just do it.
>
> Example in use within Access VB:
> DoCmd.OpenQuery "qry-append-BuildMonthlyUsage"
> DoCmd.OpenReport "rpt-ShowMonthlyUsage", acViewPreview
>
> Or is there another method that I should be using?
>
> Thank you in advance for your help,
> Michael Kintner


Try this:

DoCmd.SetWarnings False
' Your code goes here
DoCmd.SetWarnings True

 
Reply With Quote
 
=?Utf-8?B?TWF1cmljZQ==?=
Guest
Posts: n/a
 
      7th Nov 2007
You can use two ways. The first is with the DoCmd command and the second one
is to execute the query as follows:

currentdb.execute "your queryname here", dbfailonerror

The second method is:

DoCmd.SetWarnings False
docmd.openquery
docmd.set warnings true

You can see the drawback from this one. If the query fails your warnings
will not be turned on again. So in your errorhandling always place the set
warnings true option so they are set back again.

Most of the people prefer the first option of executing for that reason...

hth
--
Maurice Ausum


"Michael Kintner" wrote:

> How can I use DoCmd.OpenQuery and not have it prompt that it is performing a
> append or delete. I would like it to perform the operation without giving
> me the warnings and just do it.
>
> Example in use within Access VB:
> DoCmd.OpenQuery "qry-append-BuildMonthlyUsage"
> DoCmd.OpenReport "rpt-ShowMonthlyUsage", acViewPreview
>
> Or is there another method that I should be using?
>
> Thank you in advance for your help,
> Michael Kintner
>
>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
What Do You Use Instead of DoCmd.OpenQuery or DoCmd.RunSQL Mr. JYC Microsoft Access VBA Modules 2 30th Sep 2008 07:31 PM
docmd.openquery jmonty Microsoft Access Forms 0 25th Sep 2003 04:42 PM
Re: docmd.openquery Gina Whipp Microsoft Access Forms 0 25th Sep 2003 04:34 PM
Re: docmd.openquery StCyrM Microsoft Access Forms 0 25th Sep 2003 04:30 PM
Re: DoCmd.OpenQuery Ken Snell Microsoft Access Macros 0 22nd Jul 2003 02:36 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:52 PM.