Custom Error Message

  • Thread starter Thread starter pmarvin
  • Start date Start date
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
 
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
 
Back
Top