Can a run-time error message be suppressed?

R

Rick Brandt

scubadiver said:
If "yes", how?

Add error handling to your code routine and in the error trap test for the error
number. Do nothing for the numbers you want to ignore.

Sub SomeSub

On Error GoTo ErrHandler

(code)

Egress:
Exit Sub

ErrHandler:
Select Case Err.Number
Case x, y, x
'ignore
Case Else
MsgBox Err.Description
End Select
Resume Egress
End Sub
 
S

scubadiver

Private Sub Act_ProcNF2_Enter()

On Error GoTo ErrHandler

Me.Act_ProcNF2 = ""

ErrHandler:
Select Case Err.Number
Case -2147352567
'ignore
Case Else
MsgBox Err.Description
End Select

End Sub

"Act_ProcNF2" is a textfield that doesn't allow zero-string entries. I am
trying to make sure the default value in this text field (which is "N/A") be
deleted but it isn't happening. I now realise the error won't get suppressed
even if the message does.

So my question didn't help.
 
Top