473,396 Members | 1,785 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,396 software developers and data experts.

Suppress Access Generated Warning

Hi.

I have a routine for the AfterUpdate event of a checkbox on my Main
Menu. The checkbox causes a "User Variable" (in a table for
UserSettings) to be modified ('Y' or 'N') by issuing an UPDATE against
the tblUserSettings table.

How can I suppress the MS/Access generated warning that pops up before
the UPDATE is executed? The warning message says:

"You are about to modify 1 row(s). Once you click Yes, you can't use
the Undo command to reverse the changes. Are you sure you want to
update these records?"
Routine:

Private Sub ckUserSettings_AfterUpdate()
On Error GoTo Err_ckUserSettings_AfterUpdate

Dim strSQL As String

If Me!ckUserSettings = True Then
'Set tblUserSettings U_DisplayUserSettings to "Y"
strSQL = "UPDATE [tblUserSettings] SET [uval] = 'Y' " & _
"WHERE [uvar] = 'U_DisplayUserSettings'"
Else
'Set tblUserSettings U_DisplayUserSettings to "N"
strSQL = "UPDATE [tblUserSettings] SET [uval] = 'N' " & _
"WHERE [uvar] = 'U_DisplayUserSettings'"
End If

DoCmd.RunSQL strSQL

Exit_ckUserSettings_AfterUpdate:
Exit Sub

Err_ckUserSettings_AfterUpdate:
MsgBox "Runtime Error # " & Err.Number & vbCrLf & vbCrLf & _
Err.Description
Resume Exit_ckUserSettings_AfterUpdate

End Sub
Regards,
SueB

*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #1
4 2167
Docmd.SetWarnings = False

Don't forget to set them to True after the SQL has been executed!!!

Mark
"Susan Bricker" <sl*****@verizon.net> wrote in message
news:Ny***************@news.uswest.net...
Hi.

I have a routine for the AfterUpdate event of a checkbox on my Main
Menu. The checkbox causes a "User Variable" (in a table for
UserSettings) to be modified ('Y' or 'N') by issuing an UPDATE against
the tblUserSettings table.

How can I suppress the MS/Access generated warning that pops up before
the UPDATE is executed? The warning message says:

"You are about to modify 1 row(s). Once you click Yes, you can't use
the Undo command to reverse the changes. Are you sure you want to
update these records?"
Routine:

Private Sub ckUserSettings_AfterUpdate()
On Error GoTo Err_ckUserSettings_AfterUpdate

Dim strSQL As String

If Me!ckUserSettings = True Then
'Set tblUserSettings U_DisplayUserSettings to "Y"
strSQL = "UPDATE [tblUserSettings] SET [uval] = 'Y' " & _
"WHERE [uvar] = 'U_DisplayUserSettings'"
Else
'Set tblUserSettings U_DisplayUserSettings to "N"
strSQL = "UPDATE [tblUserSettings] SET [uval] = 'N' " & _
"WHERE [uvar] = 'U_DisplayUserSettings'"
End If

DoCmd.RunSQL strSQL

Exit_ckUserSettings_AfterUpdate:
Exit Sub

Err_ckUserSettings_AfterUpdate:
MsgBox "Runtime Error # " & Err.Number & vbCrLf & vbCrLf & _
Err.Description
Resume Exit_ckUserSettings_AfterUpdate

End Sub
Regards,
SueB

*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #2
Mark,

WOW! That was a fast reply. Thanks!!! Slight syntax change (no equal
sign ... failed with equal sign) ...

DoCmd.SetWarnings False
or
DoCmd.SetWarnings True

It did the trick. Thanks.

Regards,
SueB

*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #3
"Susan Bricker" <sl*****@verizon.net> wrote in message
news:WZ***************@news.uswest.net...
Mark,

WOW! That was a fast reply. Thanks!!! Slight syntax change (no equal
sign ... failed with equal sign) ...

DoCmd.SetWarnings False
or
DoCmd.SetWarnings True


Careful with it. Remember to put a DoCmd.SetWarnings True in the Exit label
of your error handler. Otherwise if you get an error after you've
DoCmd.SetWarnings False then they might stay off.

Mike
Nov 13 '05 #4
currentdb.execute strSQL

can be used instead of docmd.runsql. It doesn't display the warning
message.
On Fri, 08 Jul 2005 19:34:05 GMT, Susan Bricker <sl*****@verizon.net>
wrote:
Hi.

I have a routine for the AfterUpdate event of a checkbox on my Main
Menu. The checkbox causes a "User Variable" (in a table for
UserSettings) to be modified ('Y' or 'N') by issuing an UPDATE against
the tblUserSettings table.

How can I suppress the MS/Access generated warning that pops up before
the UPDATE is executed? The warning message says:

"You are about to modify 1 row(s). Once you click Yes, you can't use
the Undo command to reverse the changes. Are you sure you want to
update these records?"
Routine:

Private Sub ckUserSettings_AfterUpdate()
On Error GoTo Err_ckUserSettings_AfterUpdate

Dim strSQL As String

If Me!ckUserSettings = True Then
'Set tblUserSettings U_DisplayUserSettings to "Y"
strSQL = "UPDATE [tblUserSettings] SET [uval] = 'Y' " & _
"WHERE [uvar] = 'U_DisplayUserSettings'"
Else
'Set tblUserSettings U_DisplayUserSettings to "N"
strSQL = "UPDATE [tblUserSettings] SET [uval] = 'N' " & _
"WHERE [uvar] = 'U_DisplayUserSettings'"
End If

DoCmd.RunSQL strSQL

Exit_ckUserSettings_AfterUpdate:
Exit Sub

Err_ckUserSettings_AfterUpdate:
MsgBox "Runtime Error # " & Err.Number & vbCrLf & vbCrLf & _
Err.Description
Resume Exit_ckUserSettings_AfterUpdate

End Sub
Regards,
SueB

*** Sent via Developersdex http://www.developersdex.com ***

**********************
ja**************@telusTELUS.net
remove uppercase letters for true email
http://www.geocities.com/jacksonmacd/ for info on MS Access security
Nov 13 '05 #5

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

Similar topics

6
by: Krishna Srinivasan | last post by:
I have a form with check boxes. When accessing a check box element that is not checked, I get a notice (Notice: Undefined variable..). Is there a way to hide these notices and warning in PHP code...
4
by: Bill Dee | last post by:
I use XML comments around most of my class libraries public property and methods, for example: /// <summary> /// blah blah /// </summary> However I have a few dozen public constants as well...
9
by: Doug Ly | last post by:
Hi, When I run this query using WinSQL to connect to a DB2 database, it gave me the warning: Error: SQLSTATE 01003: Null values were eliminated from the argument of a column function. ...
1
by: Rohith | last post by:
I have written a C# application (not a add in) to access outllook. I retrieve information from Contacts,Inbox and notes folder. But when i run the application I get a Security warning from outlook...
6
by: Kim Hellan | last post by:
I want to suppress the following warning when compiling. warning CS0169: The private field 'myvar' is never used In C++ you would do something like (not sure of the syntax): #pragma nowarn:0169...
4
by: J Swift | last post by:
I posted this question earlier but on the wrong usenet. I have a warning below that I need to suppress *warning C4018: '<' : signed/unsigned mismatch I searched google, Microsoft help and MSDN...
1
by: Chris Stankevitz | last post by:
My .vcproj references an environment variable that no longer exists: Creating library... Project : warning PRJ0018 : The following environment variables were not found: $(WXWIN) How do I...
3
by: Chris Shenton | last post by:
I am setting up handlers to log DEBUG and above to a rotating file and ERROR and above to console. But if any of my code calls a logger (e.g., logging.error("foo")) before I setup my handlers, the...
13
by: Rex Mottram | last post by:
I'm using an API which does a lot of callbacks. In classic callback style, each routine provides a void * pointer to carry user-defined data. Sometimes, however, the user-defined pointer is not...
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: 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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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,...

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.