Required Field customized error message

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
 
S

Scott McDaniel

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.
 
J

John Spencer (MVP)

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top