PC Review


Reply
Thread Tools Rate Thread

Substitue user message in place of system-generated error message

 
 
Goldar
Guest
Posts: n/a
 
      21st Jan 2010
There are often times when I would like to isuue my own error message in
place of a system generated error message. A good example would be when a
message appears that indication a referential integrity violation or
cascading delete warning. I would like to customize these error messages and
warnings for my user. Is it possible to do this?

Thanks,

Gerry Goldberg
 
Reply With Quote
 
 
 
 
ghetto_banjo
Guest
Posts: n/a
 
      21st Jan 2010
yep you can do this in most cases in VB code. should be lots of
resources online, here is one: http://allenbrowne.com/ser-23a.html

If you let Access automatically program a command button by going
through the wizard, they will set this stuff up automatically, and you
can manually change the MsgBox.

here is an example of doing this when saving a record.


On Error GoTo Err_btnSaveClose_click

DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, ,
acMenuVer70

Exit_btnSaveClose_Click:
Exit Sub

Err_btnSaveClose_click:
MsgBox "There was an error while saving this record. blah blah
blah", vbOkOnly
Resume Exit_btnSaveClose_Click
 
Reply With Quote
 
 
 
 
fredg
Guest
Posts: n/a
 
      21st Jan 2010
On Thu, 21 Jan 2010 09:58:11 -0800, Goldar wrote:

> There are often times when I would like to isuue my own error message in
> place of a system generated error message. A good example would be when a
> message appears that indication a referential integrity violation or
> cascading delete warning. I would like to customize these error messages and
> warnings for my user. Is it possible to do this?
>
> Thanks,
>
> Gerry Goldberg


You can use code to replace the system message with your own.

Here's how you can find the correct error and show your own message
for any of the form level errors.

First code the Form's Error event:

MsgBox "Error#: " & DataErr ' Display the error number
Response = acDataErrDisplay ' Display Default message

Then open the form and intentionally make that error.

The message box will display the error number and then the default
error message.

Next, go back to the Form's error event and change that code to:

If DataErr = XXXX Then
Response = acDataErrContinue ' Don't display the default
message
MsgBox "Present your own message here."
Else
MsgBox "Error#: " & DataErr
Response = acDataErrDisplay ' Display Default message
End If

where XXXX is the error number.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do you substitue a value for #Error Barry Microsoft Access Queries 4 16th Jul 2008 06:42 PM
Re: Substitue Data Michel Walsh Microsoft Access Queries 1 12th Aug 2004 02:07 PM
RE: Dataset Merge substitue Ilya Tumanov [MS] Microsoft Dot NET Compact Framework 0 7th Jun 2004 10:09 PM
Substitue text strings Christer Microsoft Excel Worksheet Functions 4 4th Mar 2004 09:37 AM
substitue for vb6 IsMissing() John A Grandy Microsoft VB .NET 13 31st Jan 2004 05:57 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:04 AM.