473,394 Members | 1,843 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

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

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
5 3510
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

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
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
"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
:-) 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: Colleyville Alan | last post by:
I am now using the Execute command to run SQL for action queries. When I had them as saved queries, I would use DoCmd.SetWarnings False to allow the queries to overwrite existing tables. when I...
5
by: DC Fan | last post by:
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...
12
by: ilucks | last post by:
I converted Acc97 to Acc2003 and got this error "The command or action 'SaveRecord' isn't available now" when i tried to open one form"Add Info form", which has Save button. I checked "reference"...
16
by: busterbaxter | last post by:
Hi All, I got a multiple delete working here but for some reason I occassionally get this error. The way the delete works is there is a text box where the user enters the quantity to delete. If...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.