B
Bob Quintal
Michael
The Primary Key of a table is used to ensure each row/record is
unique. How is it that you are allowing your users to "create"
primary keys?
A good programmer will allow the user to enter a natural primary key
into a record, rather than putzing around with a surrogate
autonumber key. Besides, if one uses an autonumbre as a key, one
still needs to enforce a unique index on certain fields that should
have been made the primary key, with the Original Poster's issue of
not being able to inform the user that he's entered a duplicate
until the user tries to save the record.
Another approach, if the users must, would be to use a combobox
that LISTS all the current primary keys. When the user begins
typing, the combobox tries to find one that starts the same way.
If the one the user enters is found, the user knows that one
exists and can enter another ... but I'm still not clear on why
you want users creating them!
Good luck!
Regards
Jeff Boyce
Microsoft Office/Access MVP
Michael said:Note: This was originally posted at the queries group by mistake
......
Hi Folks - Currently, I am using the Error Event of my form to
capture duplicate key entry. However, this is not invoked until
the form updates. Is
there a way to check for a duplicate after the user tabs out of
the primary
key field? Thanks.