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

Suppress Access Generated Warning

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a
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

P: n/a
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

P: n/a
"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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.