Re: Changing default key violation message?

From: Jeff Boyce (JeffBoyce_IF_at_msn.com-DISCARD_HYPHEN_TO_END)
Date: 01/02/05


Date: Sun, 2 Jan 2005 05:26:43 -0800

Howard

You could add error handling to your code, intercept the error number, and
create/display your own message.

You could add code to the RegistrationNumber field's BeforeUpdate event that
checks for the situation and prevents it, rather than allowing a user to
fill in a form and THEN telling him/her that they couldn't do that ("start
over, you made a mistake back up in line 7"). You'd add your message in
that BeforeUpdate routine, and set Cancel = True to not accept the
duplicated registration number.

-- 
Good luck
Jeff Boyce
<Access MVP>
"Howard" <nospam@home.please.co.uk> wrote in message
news:g5qdnQT1mIvcWUrcRVn-2Q@nildram.net...
> Can this be done?
>
> How would I trap the error and present a more freindly message like "You
> cannot have two cars with the same registration number" rather than the
> complex, non user freindly message that access gives me.
>
> Howard
>
>
>


Relevant Pages

  • Re: Changing default key violation message?
    ... "Howard" wrote in message ... >> Jeff Boyce ... >> <Access MVP> ... non user freindly message that access gives me. ...
    (microsoft.public.access.formscoding)
  • Re: two records to represent one relationship
    ... BeforeUpdate event of the FORM will be AFTER the selection occurs. ... A bill of materials ... MS Access MVP ...
    (microsoft.public.access.tablesdbdesign)
  • Re: Delete Record On Close
    ... I think Unload would still be too late. ... then the place to check this is in the form's BeforeUpdate event. ... Then you can cancel the event by setting the event procedure's Cancel ... Dirk Goldgar, MS Access MVP ...
    (microsoft.public.access.formscoding)
  • Re: Require confirmation to edit
    ... When I tried it I got a Compile error, ... >>In the form's BeforeUpdate event, ... >>Wayne Morgan ... >>MS Access MVP ...
    (microsoft.public.access.forms)
  • Re: Get return PK value from SQL
    ... Is the primary key field in the subform's RecordSource query? ... should be able to read its value during the form's BeforeUpdate event, ... <MS ACCESS MVP> ... subform built-in functionality. ...
    (microsoft.public.access.modulesdaovba)