Disable Warnings Problem

lloydmav

Registered User.
Local time
Today, 06:02
Joined
Nov 15, 2002
Messages
75
Help!


I have a button which runs a delete query then an ammend query and then an update query but I wanted to get rid of the warning messages eg "You are about to delete 3 records" etc
So I added a DoCmd.SetWarnings (WarningsOff)
command. This worked but the DoCmd.SetWarnings (WarningsOn) command doesn't seem to work and now I'm getting no warning messages. Can anyone see whats wrong with the code below?



Private Sub Command6_Click()
On Error GoTo Err_Command6_Click
DoCmd.SetWarnings (WarningsOff)

Dim stDocName As String

stDocName = "DeleteActionPlanOld"
DoCmd.OpenQuery stDocName, acNormal, acEdit

Dim stDocName2 As String

stDocName2 = "AppendMaster"
DoCmd.OpenQuery stDocName2, acNormal, acEdit

Dim stDocName12 As String

stDocName12 = "UpdateTypeTask"
DoCmd.OpenQuery stDocName12, acNormal, acEdit

DoCmd.SetWarnings (WarningsOn)

Exit_Command6_Click:
Exit Sub
Err_Command6_Click:
MsgBox Err.Description
Resume Exit_Command6_Click

End Sub


Thanks for any help
:confused: :confused: :confused:
 
To turn them on...

DoCmd.SetWarnings True


and to turn them off...

DoCmd.SetWarnings False
 
Thanks for the reply yeah I just got it to work before I recieved the reply,

Thanks for the reply though!
 
Also, you might want to move the docmd.setwarnings true,

Code:
     ...
     DoCmd.OpenQuery stDocName12, acNormal, acEdit 

Exit_Command6_Click: 
     DoCmd.SetWarnings true
     Exit Sub 
Err_Command6_Click: 
     MsgBox Err.Description 
     Resume Exit_Command6_Click 
End Sub

That way warnings will be turned back on, even if you get an error.
 

Users who are viewing this thread

Back
Top Bottom