Custom Error Message

P

pmarvin

I have a table that holds information about construction sites.
Three of the fields (account number, lot number and street address)
are a mulitiple field primary key.

I have a form that is used to enter the information into this table.

If the combination of the account number, lot number and street
address have all ready been used, it will not accept this entry (which
is what I want). But I get an standard Access error message. How can I
give an error message box that will really tell the user what is
wrong and how to correct the entry?

Phil
 
M

Maurice

Trap the Access error message in the On_Error event of the form. You should
use a select case in this situation to check the number of the error that was
raised. Replace the errormessage with your own one.

Could look something like this:

Private sub Form_Error (DataErr As Integer, Response As Integer)
Select case DataErr
case= [error number here]
msgbox "Your text here"
end select
response = acDataErrContinue
end sub

hth
 

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