By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,497 Members | 2,127 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,497 IT Pros & Developers. It's quick & easy.

Command or Action 'Setwarnings' isn't available right now?

P: n/a
Hi all... Been a while since had a question here, but I can not find a
single thing about this in the group or even on the whole web! My Access XP
application is running some stored queries and some SQL statements and I am
using DoCmd.Setwarnings False to turn off the default "Are you sure"
warnings in Access. When it hit's certain setwarning commands, it gives the
error dialog in the subject of this post. An example of my code follows.
Any help or tips would be appreciated!
Sample that produces error:

DoCmd.SetWarnings False

DoCmd.RunSQL "Insert Into tblEmailLog (txtEmailStatus) SELECT '" &
strEmailStatus & "' AS txtEmailStatus;"

DoCmd.SetWarnings True

Thanks again!
Nov 12 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Response below.
Hi all... Been a while since had a question here, but I can not find a
single thing about this in the group or even on the whole web! My Access XP
application is running some stored queries and some SQL statements and I am
using DoCmd.Setwarnings False to turn off the default "Are you sure"
warnings in Access. When it hit's certain setwarning commands, it gives the
error dialog in the subject of this post. An example of my code follows.
Any help or tips would be appreciated!
Sample that produces error:

DoCmd.SetWarnings False

DoCmd.RunSQL "Insert Into tblEmailLog (txtEmailStatus) SELECT '" &
strEmailStatus & "' AS txtEmailStatus;"

DoCmd.SetWarnings True


Have you tried using the "Execute" method?

CurrentDb.Execute "INSERT INTO ...", dbFailOnError

--
Bruce M. Thompson, Microsoft Access MVP
bt******@mvps.org (See the Access FAQ at http://www.mvps.org/access)
NO Email Please. Keep all communications

within the newsgroups so that all might benefit.<<
Nov 12 '05 #2

P: n/a

SNIP
Have you tried using the "Execute" method?

CurrentDb.Execute "INSERT INTO ...", dbFailOnError


SNIP

No, I have not. I will look into it, but since I have used Setwarnings
liberally in my code, I was hoping someone may know of a cause for my error.
I have done some more investigation and found that the *same* function works
under certain conditions, but fails under other conditions. I am going to
flowchart the different scenarios to see if I can find the condition that
triggers it.

In the meantime, if anyone has a tip, please let us know!

Thanks for your response, Bruce!
Nov 12 '05 #3

P: n/a
DC Fan wrote:
Hi all... Been a while since had a question here, but I can not find a
single thing about this in the group or even on the whole web! My Access XP
application is running some stored queries and some SQL statements and I am
using DoCmd.Setwarnings False to turn off the default "Are you sure"
warnings in Access. When it hit's certain setwarning commands, it gives the
error dialog in the subject of this post. An example of my code follows.
Any help or tips would be appreciated!
Sample that produces error:

DoCmd.SetWarnings False

DoCmd.RunSQL "Insert Into tblEmailLog (txtEmailStatus) SELECT '" &
strEmailStatus & "' AS txtEmailStatus;"

DoCmd.SetWarnings True

Thanks again!


What line is it aborting on? The docmd.setwarnings False, True or
RunSQL? Put a single quote in front of the On Error line of your sub to
temporarily remove error checking.

You may also want to change the error message to
msgbox Err.number & " - " & Err.Description

It it becomes a pita, let's say the number is 2501. You could then say
If Err.Number <> 2501 then
msgbox Err.number & " - " & Err.Description
resume Exit_Label
else
Resume Next
endif

If I were to take a guess, it's burping on the RunSQL line.
Nov 12 '05 #4

P: n/a
"DC Fan" <gr*******************@comcast.net> wrote in
news:c4********************@comcast.com:
SNIP
Have you tried using the "Execute" method?

CurrentDb.Execute "INSERT INTO ...", dbFailOnError


SNIP

No, I have not. I will look into it, but since I have used
Setwarnings liberally in my code, I was hoping someone may know of
a cause for my error. I have done some more investigation and
found that the *same* function works under certain conditions, but
fails under other conditions. I am going to flowchart the
different scenarios to see if I can find the condition that
triggers it.


Who cares why SetWarnings doesn't work?

Why do in 3 lines of code what you can do in 1?

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 12 '05 #5

P: n/a
:-) Knowledge is always a good thing.

I will update this thread after I experiment tomorrow. Thanks for your tip!
"David W. Fenton" <dX********@bway.net.invalid> wrote in message
news:Xn**********************************@24.168.1 28.78...
"DC Fan" <gr*******************@comcast.net> wrote in
news:c4********************@comcast.com:
SNIP
Have you tried using the "Execute" method?

CurrentDb.Execute "INSERT INTO ...", dbFailOnError


SNIP

No, I have not. I will look into it, but since I have used
Setwarnings liberally in my code, I was hoping someone may know of
a cause for my error. I have done some more investigation and
found that the *same* function works under certain conditions, but
fails under other conditions. I am going to flowchart the
different scenarios to see if I can find the condition that
triggers it.


Who cares why SetWarnings doesn't work?

Why do in 3 lines of code what you can do in 1?

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc

Nov 12 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.