Re: Changing default key violation message?
From: Jeff Boyce (JeffBoyce_IF_at_msn.com-DISCARD_HYPHEN_TO_END)
Date: 01/02/05
- Next message: Marshall Barton: "Re: Getting the time down to milliseconds"
- Previous message: Jeff Boyce: "Re: Makeing at least one record required! Re-post"
- In reply to: Howard: "Re: Changing default key violation message?"
- Next in thread: Howard: "Re: Changing default key violation message?"
- Reply: Howard: "Re: Changing default key violation message?"
- Messages sorted by: [ date ] [ thread ]
Date: Sun, 2 Jan 2005 11:40:12 -0800
Howard
What you've proposed requires Access to use a (somewhat) slower function
("DCount()"). But hey! whatever works! Have you tested your code?
--
Good luck
Jeff Boyce
<Access MVP>
"Howard" <nospam@home.please.co.uk> wrote in message
news:y6Sdna8hGvl4mUXcRVn-2g@nildram.net...
> Thank you Jeff,
>
> I presume I could check for the situation using something like the
following
>
> If DCount("*","[Cars]","[CarReg]=" & Me!CarReg) >= 0 Then
> MsgBox "This car already exists", vbOKOnly
> Cancel = True
> end if
>
> Howard
>
> "Jeff Boyce" <JeffBoyce_IF@msn.com-DISCARD_HYPHEN_TO_END> wrote in message
> news:uasEv5M8EHA.2192@TK2MSFTNGP14.phx.gbl...
> > 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
> >>
> >>
> >>
> >
>
>
- Next message: Marshall Barton: "Re: Getting the time down to milliseconds"
- Previous message: Jeff Boyce: "Re: Makeing at least one record required! Re-post"
- In reply to: Howard: "Re: Changing default key violation message?"
- Next in thread: Howard: "Re: Changing default key violation message?"
- Reply: Howard: "Re: Changing default key violation message?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|