Home All Groups Group Topic Archive Search About

Action messages in access 2007 runtime

Author
27 Sep 2007 2:30 AM
BobK
When I run an MDE in acess 2007 runtime, I get the action messages I.E. "1
record will be updated".  DO I use:

DoCmd.SetWarnings False

to turn off these messages?

Thank you

BobK

Author
27 Sep 2007 3:36 AM
Tony Toews [MVP]
BobK <B***@discussions.microsoft.com> wrote:

>When I run an MDE in acess 2007 runtime, I get the action messages I.E. "1
>record will be updated".  DO I use:
>
> DoCmd.SetWarnings False
>to turn off these messages?

You could but it's not recommended.

I prefer, if DAO, to use Currentdb.Execute strSQL,dbfailonerror
command instead of docmd.runsql.  For ADO use
CurrentProject.Connection.Execute strCommand, lngRecordsAffected,
adCmdText 

If you're going to use docmd.setwarnings make very sure you put the
True statement in any error handling code as well.   Otherwise weird
things may happen later on especially while you are working on the
app.  For example you will no longer get the "Do you wish to save your
changes" message if you close an object.  This may mean that unwanted
changes, deletions or additions will be saved to your MDB.

Also performance can be significantly different between the two
methods.  One posting stated currentdb.execute took two seconds while
docmd.runsql took eight seconds.  As always YMMV.

Tony
--
Tony Toews, Microsoft Access MVP
   Please respond only in the newsgroups so that others can
read the entire thread of messages.
   Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
   Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
Author
27 Sep 2007 1:07 PM
BobK
Thank you.  I have changed all my docmd.runsql to Currentdb.Execute
strSQL,dbfailonerror and the messages did indeed stop.  Was this documented
somewhere that I might have missed that the preferred way is now 
Currentdb.Execute strSQL,dbfailonerror?  I would like to see if I am missing
anything, or changing something else.

BobK

Show quote
"Tony Toews [MVP]" wrote:

> BobK <B***@discussions.microsoft.com> wrote:
>
> >When I run an MDE in acess 2007 runtime, I get the action messages I.E. "1
> >record will be updated".  DO I use:
> >
> > DoCmd.SetWarnings False
> >to turn off these messages?
>
> You could but it's not recommended.
>
> I prefer, if DAO, to use Currentdb.Execute strSQL,dbfailonerror
> command instead of docmd.runsql.  For ADO use
> CurrentProject.Connection.Execute strCommand, lngRecordsAffected,
> adCmdText 
>
> If you're going to use docmd.setwarnings make very sure you put the
> True statement in any error handling code as well.   Otherwise weird
> things may happen later on especially while you are working on the
> app.  For example you will no longer get the "Do you wish to save your
> changes" message if you close an object.  This may mean that unwanted
> changes, deletions or additions will be saved to your MDB.
>
> Also performance can be significantly different between the two
> methods.  One posting stated currentdb.execute took two seconds while
> docmd.runsql took eight seconds.  As always YMMV.
>
> Tony
> --
> Tony Toews, Microsoft Access MVP
>    Please respond only in the newsgroups so that others can
> read the entire thread of messages.
>    Microsoft Access Links, Hints, Tips & Accounting Systems at
> http://www.granite.ab.ca/accsmstr.htm
>    Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
>
Author
27 Sep 2007 7:41 PM
Tony Toews [MVP]
BobK <B***@discussions.microsoft.com> wrote:

>Thank you.  I have changed all my docmd.runsql to Currentdb.Execute
>strSQL,dbfailonerror and the messages did indeed stop.  Was this documented
>somewhere that I might have missed that the preferred way is now 
>Currentdb.Execute strSQL,dbfailonerror?  I would like to see if I am missing
>anything, or changing something else.

I have no idea if this is officially recommended by Microsoft.
However I've been using currentdb.execute for close on to a decade
now.

Tony
--
Tony Toews, Microsoft Access MVP
   Please respond only in the newsgroups so that others can
read the entire thread of messages.
   Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
   Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/

AddThis Social Bookmark Button