Bawn
Bawn

Reputation: 509

How to change the Contents of a msg box

enter image description here

I have a form for creating a record, I also have a button on the top of the form for to return to a form called home. When the form is being viewed and half the information is put in and the home button is clicked an error pops up saying " you cannot add or change a record beacasue a related record is required in a table "Elements"." How do I Change what the content of the error message is ?

Upvotes: 0

Views: 58

Answers (2)

armadadrive
armadadrive

Reputation: 981

Here is a resource on error-handling in VBA: http://allenbrowne.com/ser-23a.html

I'm not sure, however, if you can create a handler in VBA for standard program error messages.

Upvotes: 1

mr.Reband
mr.Reband

Reputation: 2430

You can put checks in your button_click sub to circumvent -- check to make sure all fields are filled in, and if not, display your own message box followed by

 Exit Sub

That will short circuit the rest of the method so you should not get the standard message.

Upvotes: 3

Related Questions