Required Field customized error message

  • Thread starter Thread starter Ahmed
  • Start date Start date
A

Ahmed

hi,
how can i modify the required field error meesage. i want
to dispaly my own customized error message to the user.
how can i do this?

thanx
 
You must trap the error and then display your own message. To do so, most
use this syntax:

Sub YourSub()
On Error GoTo ProcErr

<code here>

ProcExit:
Exit Sub

ProcErr:
Select Case Err.Number
Case 1
Case 2
Case Else
End Select

You would substitute Case 1, Case 2 etc for your particular error number.
For example, it you want to trap for error 7970, then change Case 1 to Case
7970, then add the MsgBox you wish to present to the user (if any).

I'd suggest you read up on Error Handling to fully understand this issue.
 
Where do you need to do this?

On a form? You can trap the error in the Form's OnError Event and handle it there.

In VBA code somewhere? (If so, can you post the code that is causing the problem?)

In a table? (As far as I know this cannot be done)

In an SQL query?
 
Back
Top