Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Personalised error messages 1

Status
Not open for further replies.

Samulayo

Programmer
Aug 13, 2002
46
GB
How would i be able to get personnalised error messages so that if say, Error 3022 (replicate record) appears, instead of giving the long list and asking to either end or debug, it would say "this is a duplicate value" then an OK button which resets the problem (in this case the date) or scrubs the record and shows a new one.

Regards
Samulayo
 
Example:

Public Sub Test()
On Error GoTo TrapErr

'Main code goes here.

ExitHere:
Exit Sub

TrapErr:
Select Case Err.Number
Case 3022
msgbox "Duplicate record entered!",vbOkOnly,"Error."
Case Else
msgbox err.description
End Select

End Sub

Please do not feed the trolls.....
 
thank you very much ed2020, thats exactly what i've been looking for, but i didnt expect it to be such a simple command though. Have a star for being so helpful (did that sound patronising)

Regards

Samulayo
 
Nope, not patronising at all. Thanks for the star. :)

Please do not feed the trolls.....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top