Suppressing a warning message 
Author Message
 Suppressing a warning message

I'm trying to do a save record operation via:

    DoCmd.RunCommand acCmdSaveRecord

However, in my form BeforeUpdate event I check for a few
error conditions.  If I find an error display a message
and I set the Cancel parm to the event routine to True.  
This works fine.  But, each time I do this I get the
dialog box:

"The RunCommand action was canceled"

which I need to dismiss with the OK button.  I've tried
putting in

    DoCmd.SetWarnings False

prior to the DoCmd.RunCommand acCmdSaveRecord, but it
seems to have no effect, I still get the message.  Does
anyone know now to suppress this warning message from
Access.

Thanks,
Leif



Mon, 05 Dec 2005 03:23:02 GMT  
 Suppressing a warning message
Trap the error and ignore it if it's 2501:

On Error Resume Next
DoCmd.RunCommand acCmdSaveRecord
If Err.Number <> 2501 And Err.Number <> 0 Then
    MsgBox "An error has occurred:  number " & Err.Number & ": " &
Err.Description
Else
    Err.Clear
End If

--
       Ken Snell
<MS ACCESS MVP>


Quote:
> I'm trying to do a save record operation via:

>     DoCmd.RunCommand acCmdSaveRecord

> However, in my form BeforeUpdate event I check for a few
> error conditions.  If I find an error display a message
> and I set the Cancel parm to the event routine to True.
> This works fine.  But, each time I do this I get the
> dialog box:

> "The RunCommand action was canceled"

> which I need to dismiss with the OK button.  I've tried
> putting in

>     DoCmd.SetWarnings False

> prior to the DoCmd.RunCommand acCmdSaveRecord, but it
> seems to have no effect, I still get the message.  Does
> anyone know now to suppress this warning message from
> Access.

> Thanks,
> Leif



Mon, 05 Dec 2005 03:32:08 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. suppress warning message

2. Suppress warning message

3. Suppressing warning messages

4. Trapping Warning Messages, NOT Error Messages

5. Get a warning message when programatically forward message

6. VB code to suppress delete warnings.

7. suppress warnings on DoCmd.RunSQL ?

8. Suppressing add to list warning

9. How to suppress Outlook 2002 warning

10. Suppress warning when deleting

11. wdDialogFileOpen dialog suppressing macro warning

12. Suppress CreateObject Security warning??

 

 
Powered by phpBB® Forum Software