Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / March 2008

Tip: Looking for answers? Try searching our database.

Application.DisplayAlerts

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jac Tremblay - 12 Mar 2008 06:16 GMT
Hi,
I cannot find how to prevent a message to be displayed when I try to insert
a record with the following command:
DoCmd.RunSQL strSql, UseTransaction:=False
Would anyone know some way to bypass the alert message?
Thanks
Signature

Jac Tremblay

Steve Sanford - 12 Mar 2008 06:45 GMT
Try this

  DoCmd.SetWarnings False
  DoCmd.RunSQL strSql, UseTransaction:=False
  DoCmd.SetWarnings True

but you need to ensure that warnings is set to "True" (in the error
handling) if there an error occures before you reach the " DoCmd.SetWarnings
True" line.

I prefer to use:

Currentdb.Execute strSQL,dbFailOnError

See help on the Execute method and the SetWarnings command.

HTH
Signature

Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)

> Hi,
> I cannot find how to prevent a message to be displayed when I try to insert
> a record with the following command:
> DoCmd.RunSQL strSql, UseTransaction:=False
> Would anyone know some way to bypass the alert message?
> Thanks
Jac Tremblay - 12 Mar 2008 15:54 GMT
Hi Steve,
This answers my question all right. I found out that I had myself used the
line:
Currentdb.Execute strSQL, dbFailOnError
in another project and never got any error. I will read about the difference
between the two in MSDN when I get the time (that will be soon).
In the mean time, I will use:
Currentdb.Execute strSQL, dbFailOnError
Thank you for your answer.
Signature

Jac Tremblay

> Try this
>
[quoted text clipped - 20 lines]
> > Would anyone know some way to bypass the alert message?
> > Thanks
Klatuu - 12 Mar 2008 16:35 GMT
I prefer the Execute method.
It is faster to execute.
The reason it doesn't trigger the alert messages is that it does not go
through the Access User Interface.  It goes directly to Jet.  The Alerts are
in the UI.  Now, the reason for the dbFailOnError is that since it doesn't go
through the UI, it will not throw an Access error, but the dbFailOnError
forces the error.

With a one record hit, you will hardly notice any difference; however, if
the SQL affects multiple records, you will notice the performance difference.

BTW, I don't agree with the previous poster's statment regarding the
SetWarnings statement.  It really has nothing to do with error handling.  I
keep my Display Alerts turned off all the time.  I also have error handlers
in almost every procedure.
Signature

Dave Hargis, Microsoft Access MVP

> Hi Steve,
> This answers my question all right. I found out that I had myself used the
[quoted text clipped - 30 lines]
> > > Would anyone know some way to bypass the alert message?
> > > Thanks
Jac Tremblay - 12 Mar 2008 16:49 GMT
Hi Dave,
Your point is very interesing and I take good note of it. I will keep that
in mind for future development.
Thank you very much.
Signature

Jac Tremblay

> I prefer the Execute method.
> It is faster to execute.
[quoted text clipped - 46 lines]
> > > > Would anyone know some way to bypass the alert message?
> > > > Thanks
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.