Re: GENERATE ERROR FOR UNIQUE FIELD ON FORM
From: Steve Schapel (schapel_at_mvps.org.ns)
Date: 02/08/05
- Next message: Shivalee Gupta via AccessMonster.com: "Re: link subform?"
- Previous message: Alan Z. Scharf: "Re: Requery DropDown on New Record"
- In reply to: Sammie: "GENERATE ERROR FOR UNIQUE FIELD ON FORM"
- Next in thread: Sammie: "Re: GENERATE ERROR FOR UNIQUE FIELD ON FORM"
- Reply: Sammie: "Re: GENERATE ERROR FOR UNIQUE FIELD ON FORM"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 08 Feb 2005 21:36:41 +1300
Sammie,
Here's one approach, for code on the BeforeUpdate event of the textboxes
on the "other" form...
If DCount("*","YourTable","FieldValue='" & Me.ControlValue & "'")>0 Then
MsgBox "You've already got one of those"
Cancel = True
End If
(assumes a text data type)
-- Steve Schapel, Microsoft Access MVP Sammie wrote: > I have a form used to enter new records in response to a not-in-list > event. It contains 2 fields which do not allow duplicates. Niether of > these two fields is the primary key. The problem is that the user > doesn't see that they have entered a duplicate until after they have > closed the form and they receive an error on the not-in-list event. How > can Access prevent the user from entering a duplicate when they enter > the field, so they know exactly why it is not an acceptable entry? I'm > having trouble writing error handling code on my not-in-list procedure, > when I think it's the duplicates on the other form that are causing the > problem. > > Thanks. > Sammie
- Next message: Shivalee Gupta via AccessMonster.com: "Re: link subform?"
- Previous message: Alan Z. Scharf: "Re: Requery DropDown on New Record"
- In reply to: Sammie: "GENERATE ERROR FOR UNIQUE FIELD ON FORM"
- Next in thread: Sammie: "Re: GENERATE ERROR FOR UNIQUE FIELD ON FORM"
- Reply: Sammie: "Re: GENERATE ERROR FOR UNIQUE FIELD ON FORM"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|