A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Overriding constraint violation message



 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old April 21st, 2010, 10:00 AM posted to microsoft.public.sqlserver.programming,microsoft.public.access.forms
Arvi Laanemets
external usenet poster
 
Posts: 397
Default Overriding constraint violation message

Hi

I'm at my first try to use SQL Server as back-end database for Access
front-end.

On SQL Server, I created constraints (additionally to primary key) for my
tables:
a) foreign key constraints to control data integrity (deleting entries
linked to other tables isn't allowed);
b) check constraints (certain fields or combination of fields must be
unique).

It works all fine in access, but when those constraints are triggered, the
message returned to access is a mess for an average user. Is there a way to
replace those messages with my own, p.e. like:
"Deleting isn't allowed because data are used in other tables!" or "This
name is in use!"

It looks like I can catch the error in OnError event for form, but how can I
override the error message - usual On Error routine doesn't work
(Err.Number=0), and I'm afraid whatever message I'm programming, standard
transaction error message gets displayed too.


Thanks in advance!
Arvi Laanemets

 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:48 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.