Hi Bob,
Your explanation helps.
Your best link to this kind of issue is to keep a dialogue going with
John Vinson until you understand the issues and his suggested
solution(s). He KNOWS these things!
You seem to be trying to force your users into miss-representing the
real world so that your application will return correct results. In
our business, it's a given that it's more important to get things
right than to get them quickly or even easily. We strive to do all of
those things but data integrity comes way ahead of what ever may be in
second place.
You may have to work with your users to promote mutual understanding
of the issues and the best resolution for each one. Your users and
their assumed level of knowledge about what they're doing as they use
your application is very important. However, the responsibility for
bullet proofing the application is your. That's why you surfaced the
issue here
Do they KNOW that the data they want to enter is about
someone whose name should already be in the database?
Your users must be made aware that names are not necessarily unique
and that some speed may have to be sacrificed to assure that they're
entering data against the correct PERSON's record. To begin, I'd get
rid of that UNIQUE constraint on the full name. It forces your
application to create data that's different from the real world. If
your list of names isn't huge, you can use an autoexpanding combobox
to bring up the name just entered and to make the fact that there is
more than one name like that in your database evident. On the lookup
I'd include some other fairly unique piece of information to help
resolve which person is the right one. For larger lists, the
autoexpand feature may slow you too much. You could also use the
NotInList event of the combobox to alert your user that the name they
typed doesn't exist in the database and ask them if they'd like to add
the name...
There are lots of books about Access and some of them are very good.
I particularly recommend "The Access [YourVersion] Developer's
Handbook" by Ken Getz et al from Sybex. You should only need Volume
1, the Desktop edition. There is about half a page of references to
specific performance issues in the index. There is a lot of
information in Microsoft's Knowledge Base but you have to seek it out
one problem at a time.
HTH
--
-Larry-
--
p.s. Just looked at your web site. It looks nice and useful. It's
been over 30 years since I last visited Washington I understand that
Whidby Island is beautiful.
Bob Richardson said:
I don't think I've been clear about what I'd like to do. My primary key is
an autonumber key. This is necessary, among other reasons, because people
change names, and a long name is a cumbersome key to drag around a lot of
files.
That said, users of the DB think of names as the main key. When two people
have the same name, changes to the name can be made to make them unique.
Instead of two John Smith's, you can have one John R Smith, and one John S
Smith. There are various ways to make the names unique. People with common
names often have nicknames that they've used throughout their lives to cope
with their "problem." John "Fuzzy" Smith.
What I'm trying to do is force the person entering data to some up with
unique names, if that's necessary. Thus, I have made Lastname/Firstname a
unique key. When the user tries to exit the form, I want to print my own
error message and put the user back into the form. How would I do that? Use
the Form's OnExit? When/where is the duplicate key error raised?