rfritter
May 23 2006, 02:22 PM
I've created several processes (subs) and execute them in 1/2 dozen steps. At the end of the process, I update a control table with the date of the last execution of this string. As a result of the update, a warning message is created that pops up and waits for a reply.
When testing is completed, this process will execute over the week end and so this warming message must be turned off. I know how to turn it off using the pull-down menus but have not been able to find how to turn it off using VBA.
Would someone please help!!
Thanks
dashiellx2000
May 23 2006, 02:23 PM
Turn off the warnings with:
DoCmd.SetWarnings False
Then to turn them back on:
DOCmd.SetWarnings True
HTH.
freakazeud
May 23 2006, 02:26 PM
Hi,
you should avoid to turn warnings off. Instead you should execute your statement/query with this:
CurrentDb.Execute "statement/query",dbFailOnError
HTH
Good luck
rfritter
May 23 2006, 02:28 PM
dashiellx2000, wow, thats simple.
Looked in a lot of places but didn'l look in the DoCmd
thanks
dashiellx2000
May 23 2006, 02:30 PM
You are welcome, but I would point to Freakazeud's post the the CurrentDb.Execute method is probably better. I stopped using SetWarnings and use the method he suggests myself.
rfritter
May 23 2006, 02:42 PM
In order to use the command, CurrenDt.Execute, am I correct in assuming that I would need to establish an DAO object to connect to the DB?
rfritter
May 23 2006, 02:43 PM
CurrentDb!!
dashiellx2000
May 23 2006, 02:44 PM
Yes, that is correct:
Dim db as DAO.Database
Set db = CurrentDb()
db.Execute = SQL String.
HTH.
niesz
May 23 2006, 02:53 PM
Check out Cheeky's comments about DAO/ADO execution in
this thread...
rfritter
May 23 2006, 03:18 PM
Thanks
Just to clarify, to this point I've not being using VB only VBA, were on the same page, right?? I've not been using DAO, so will have to do some thinking and reading about how to hook everythig together.
Needed to learn it anyway; was just hoping to put it off awhile.
Thanks
niesz
May 23 2006, 03:23 PM
Just to clarify...
VB is not part of Access---only VBA. Sometimes people here refer to the code page in Access as VB. This is VBA.
DAO is not necessary to do what you are wanting. You can use native ADO.
CurrentProject.Connection.Execute strSQL
rfritter
May 23 2006, 03:30 PM
niesz, thanks very much for the clarification. Very helpful. Thanks to all for your responces and willing to be helpful.
niesz
May 23 2006, 03:31 PM
Glad we could help.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.