View Single Post
  #3  
Old November 18th, 2009, 03:30 AM posted to microsoft.public.access.forms
Al Campagna[_2_]
external usenet poster
 
Posts: 1,462
Default eliminate Duplicate entries

Ed,
Several ways to do that...
Use the BeforeUpdate event of the WO control.
Do a Dlookup with the new WO value, to see if a dupe exists. If so,
mesaage the user, and
Cancel = True
WO.Undo
Otherwise continue...

I would suggest that you not allow users to create/enter/edit key field
values.
It's OK that they enter a WO number, but you should have your own "real"
key field (ex. autonumber) hidden... and handling the relationships
in the background.
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."


Ed Sexton wrote in message ...
I have a DB for tracking workorders, I want to notify the operator when
they have entered a duplicate work order number.
Conditions
Table name: WorkOrder
Field Name: WO
The WO field is the primary key for teh table and I've selected duplicates
no for the field. I used the table to create the form, and want to
generate a error message when a duplicate owrk order is entered in the
form field. Presently, the at entry, the form closes and if the work order
number is a duplicate, the new entry is trashed with no indicateion to the
operator.

EggHeadCafe - Software Developer Portal of Choice
.NET GDI+ - Draw Tree / Hierarchy
http://www.eggheadcafe.com/tutorials...w-tree--h.aspx