Paul wrote:
I tried putting a message on the OnError event (it works) my message
appears, but then after my message comes up, the Access message comes up too
right after.
Is there a way to get rid of the default access message?
Yes. In the on Error event, after your line of code for the message
box, type in:
Private Sub Form_Error(DataErr As Integer, Response As Integer)
If DataErr = <number for the data error you're trapping> then
Msgbox <whatever>
Response = acDataErrContinue
end if
End Sub
YOu can use a select statement or even dispense with an if or reference
to the dataerr number at all if you're OK.
Note that the DataErr argument refers to the err collection of errors
that you use in error trapping.
If your level is at the point where nothing what I wrote makes any sense
to you yet - and I'm not trying to be nasty here, Paul, we are all at
different stages in our infinite learning curves 8) - the main thing to
remember is the line:
Response = acDataErrContinue
after your message box.
All due respect to Alan, who is miles higher than I am in terms of
competence and experience, I personally try and have the structure of
the data tables do as much work as possible for me. It's too easy to
induce a bug or forgotten something or other when you are writing long
code to apply business rules in code called from the form rather
applying those rules via database structure.
For me, anyway... that comes from an Oracle background where one does
have triggers and things Alan is crying out for! 8)
--
Tim
http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "What's UP, Dittoooooo?" - Ditto