473,734 Members | 2,211 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

What would you recommend as a harmless test to determine state of SetWarnings in A97

MLH
Access 97 does not provide a means of reading the
most recent setting for SetWarnings Method. For
example, if you had CBF that called a procedure in
a global module and the following statement was
executed:

DoCmd.SetWarnin gs False

Then you would not be able to take peek at the
setting when processing returned to the calling
procedure. You'd simply have to run the Method
there again to make sure the setting is what you
want it to be from that point forward.

I'm not saying there's anything wrong with that.
One can simply adapt. What is unhandy about not
being able to read the setting? Well, if you are
deliberately trying to identify and correct instances
where the setting is not what you intended for it to
be after calling some saved procedure.

I'd like to have a procedure that did something
trivial - something with no adverse effect that
when called, would do something that could
determine the setting - indirectly perhaps. Then
I could sprinkle my code with calls to this procedure
as liberally as I wanted. At some point I would be
satisfied, I'm sure, that SetWarnings settings made
in called procedures did not leave things in an
unexpected state upon return to the calling
procedure.
Mar 12 '08 #1
5 1934
On Tue, 11 Mar 2008 21:10:26 -0400, MLH <CR**@NorthStat e.netwrote:

Simple: in a standard module create this:
private m_blnWarningSta te as Boolean
public sub SetWarningsOff( )
docmd.SetWarnin gs False
m_blnWarningSta te = False
end sub
public sub SetWarningsOn()
docmd.SetWarnin gs True
m_blnWarningSta te = True
end sub
public function GetWarningState () as Boolean
GetWarningState = m_blnWarningSta te
end function

-Tom.

>Access 97 does not provide a means of reading the
most recent setting for SetWarnings Method. For
example, if you had CBF that called a procedure in
a global module and the following statement was
executed:

DoCmd.SetWarni ngs False

Then you would not be able to take peek at the
setting when processing returned to the calling
procedure. You'd simply have to run the Method
there again to make sure the setting is what you
want it to be from that point forward.

I'm not saying there's anything wrong with that.
One can simply adapt. What is unhandy about not
being able to read the setting? Well, if you are
deliberately trying to identify and correct instances
where the setting is not what you intended for it to
be after calling some saved procedure.

I'd like to have a procedure that did something
trivial - something with no adverse effect that
when called, would do something that could
determine the setting - indirectly perhaps. Then
I could sprinkle my code with calls to this procedure
as liberally as I wanted. At some point I would be
satisfied, I'm sure, that SetWarnings settings made
in called procedures did not leave things in an
unexpected state upon return to the calling
procedure.
Mar 12 '08 #2
Since Access does not provide a way to test this setting, Tom's suggestion
makes good sense.

A more fundamental question might be why you need to set this. IME, people
turn this off to suppress the messages when running action queries. That's
not a good idea: you have no idea whether the action query worked or ran
into errors.

A better solution (which avoids the need to mess with SetWarnings) might be
to use Exeucte with the action query:
http://allenbrowne.com/ser-60.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Tom van Stiphout" <no************ *@cox.netwrote in message
news:dq******** *************** *********@4ax.c om...
On Tue, 11 Mar 2008 21:10:26 -0400, MLH <CR**@NorthStat e.netwrote:

Simple: in a standard module create this:
private m_blnWarningSta te as Boolean
public sub SetWarningsOff( )
docmd.SetWarnin gs False
m_blnWarningSta te = False
end sub
public sub SetWarningsOn()
docmd.SetWarnin gs True
m_blnWarningSta te = True
end sub
public function GetWarningState () as Boolean
GetWarningState = m_blnWarningSta te
end function

-Tom.

>>Access 97 does not provide a means of reading the
most recent setting for SetWarnings Method. For
example, if you had CBF that called a procedure in
a global module and the following statement was
executed:

DoCmd.SetWarn ings False

Then you would not be able to take peek at the
setting when processing returned to the calling
procedure. You'd simply have to run the Method
there again to make sure the setting is what you
want it to be from that point forward.

I'm not saying there's anything wrong with that.
One can simply adapt. What is unhandy about not
being able to read the setting? Well, if you are
deliberatel y trying to identify and correct instances
where the setting is not what you intended for it to
be after calling some saved procedure.

I'd like to have a procedure that did something
trivial - something with no adverse effect that
when called, would do something that could
determine the setting - indirectly perhaps. Then
I could sprinkle my code with calls to this procedure
as liberally as I wanted. At some point I would be
satisfied, I'm sure, that SetWarnings settings made
in called procedures did not leave things in an
unexpected state upon return to the calling
procedure.
Mar 12 '08 #3
On Wed, 12 Mar 2008 22:24:29 +0900, "Allen Browne"
<Al*********@Se eSig.Invalidwro te:

I agree. The only positive thing about DoCmd.RunSQL and its cousins is
that they provide a progress meter, whereas .Execute does not.

Don't forget to run .Execute with the dbFailOnError flag, in most
cases.

-Tom.

>Since Access does not provide a way to test this setting, Tom's suggestion
makes good sense.

A more fundamental question might be why you need to set this. IME, people
turn this off to suppress the messages when running action queries. That's
not a good idea: you have no idea whether the action query worked or ran
into errors.

A better solution (which avoids the need to mess with SetWarnings) might be
to use Exeucte with the action query:
http://allenbrowne.com/ser-60.html
Mar 12 '08 #4
On Mar 11, 9:10*pm, MLH <C...@NorthStat e.netwrote:
Access 97 does not provide a means of reading the
most recent setting for SetWarnings Method. For
example, if you had CBF that called a procedure in
a global module and the following statement was
executed:

DoCmd.SetWarnin gs False

Then you would not be able to take peek at the
setting when processing returned to the calling
procedure. You'd simply have to run the Method
there again to make sure the setting is what you
want it to be from that point forward.

I'm not saying there's anything wrong with that.
One can simply adapt. What is unhandy about not
being able to read the setting? Well, if you are
deliberately trying to identify and correct instances
where the setting is not what you intended for it to
be after calling some saved procedure.

I'd like to have a procedure that did something
trivial - something with no adverse effect that
when called, would do something that could
determine the setting - indirectly perhaps. Then
I could sprinkle my code with calls to this procedure
as liberally as I wanted. At some point I would be
satisfied, I'm sure, that SetWarnings settings made
in called procedures did not leave things in an
unexpected state upon return to the calling
procedure.

private bWarningState as Boolean

public sub ToggleWarningSt ate(bState as boolean)
DoCmd.SetWarnin gs bState
bWarningState = bState
end sub

public function CurrentWarningS tate() as Boolean
CurrentWarningS tate = bWarningState
end function

Similar to above with less code. Shoudl work just fine.
Mar 12 '08 #5
On Wed, 12 Mar 2008 07:15:29 -0700, Tom van Stiphout <no************ *@cox.net>
wrote:
>On Wed, 12 Mar 2008 22:24:29 +0900, "Allen Browne"
<Al*********@S eeSig.Invalidwr ote:

I agree. The only positive thing about DoCmd.RunSQL and its cousins is
that they provide a progress meter, whereas .Execute does not.

Don't forget to run .Execute with the dbFailOnError flag, in most
cases.

-Tom.
I agree .Execute is generally the preferred method, however because DoCmd.RunSQL
is executed via the Access expression service rather than the Jet expression
service (used by Execute), their are instances where an SQL string will fail
using .Execute but will suceed using RunSQL.

Notably DoCmd.RunSQL can usually handle calls to custom functions within the SQL
string without having to concatenate the result of the function into the string
first.
Wayne Gillespie
Gosford NSW Australia
Mar 12 '08 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
3301
by: Steven T. Hatton | last post by:
This is something I've been looking at because it is central to a currently broken part of the KDevelop new application wizard. I'm not complaining about it being broken, It's a CVS images. Such things happen. The whole subsystem is going through radical changes. I don't really want to say what I think of the code just yet. That would influence the opinions of others, and I really want to know how other people view these things,...
3
5564
by: Odd Bjørn Andersen | last post by:
Every night at 21.30 we perform a full offline database backup. Just before the backup starts we do a db2stop/db2start. After the db2stop there is a message in the db2diag.log, and after the backup there is another message. And this happens every time. Here is an extract of the db2diag.log: 2004-03-01-21.30.38.812504 Instance:db2bpu1 Node:000 PID:25106(db2stop2) Appid:none base_sys_utilities stopdbm Probe:911 Database manager is...
3
1683
by: Rod | last post by:
In Dino Esposito's book, "Programming Microsoft ASP.NET", there is a chapter titled, "ASP.NET State Management". There is a section in there discussing session state sometimes going away. He mentions that in version 1.1 of ASP.NET, that it isn't possible for the application to know about the session expiring. He gives a work around which you can try using that is put into the Session_Start event, which would first determine if there...
10
7219
by: MLH | last post by:
I thought I could run docmd.SetWarnings in the immediate window with no argument and A97 would return True or False, depending on the current setting. I was wrong. Anybody know how to make the determination in the immediate window?
53
3180
by: jaso | last post by:
Can you give any comments on this code? I used one goto, is it bad? #include <stdio.h> #include <stdlib.h> #include <ctype.h> #include <string.h> #include <assert.h> #define NOT_NULL 1
6
2278
by: MLH | last post by:
In my Tues, Mar 21 2006 original post on this topic, Allen Browne made a very good case for use of the Execute method instead of firing an action query with RunSQL or OpenQuery. Ex- ploring the topic just a bit further... I'm wondering if VB receives any event notice indicating that a confirmation dialog just opened? That is, can I tell if a confirmation dialog WAS encountered and then act on it?
82
31132
by: quiberon2 | last post by:
Hi, Sorry if it might be a stupid question but what should returns malloc(0) ? void *ptr = malloc(0); I am running gcc 3.3.5 and a non-null address is returned. ( in the compiler that I am currently implementing, NULL is returned. Is it wrong ?)
14
3741
by: salad | last post by:
XML seems to be a hot technology buzzword. And it appears XML is supported in A2003. I am wondering if it could be used in the following scenario. I create an order record for the customer. This customer is one I do a lot of business with. I could create an email to send him a copy of the order. A more preferable approach would be to transfer to the customer the order and order items parts which could then be imported/used to update...
48
2502
by: Ark Khasin | last post by:
Unit testing is an integral component of both "formal" and "agile" models of development. Alas, it involves a significant amount of tedious labor. There are test automation tools out there but from what limited exposure I've had, they are pricey, reasonably buggy, and require compiler/target adaptation. Out of my frustration with two out of two of them came my own. Its instrumentation approach is based solely on profound abuse of the C
0
8946
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8776
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9310
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8186
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6735
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6031
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3261
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2724
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2180
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.