473,473 Members | 1,468 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

a way to prevent duplicate contact records?

Can I set it up so that a certain combination of fields can't contain the
same entries, on another record? e.g. a combination of
FirstName/LastName/address? Or FirstName/LastName/phone? Or
FirstName/LastName/email?

Or is it possible to allow this but to throw up an alert message? Warning
that this person is probably already in the database? TIA


Nov 12 '05 #1
9 14547
On Wed, 26 Nov 2003 12:30:01 -0500, "Catherine Jo Morgan" <cj******@hemc.net>
wrote:
Can I set it up so that a certain combination of fields can't contain the
same entries, on another record? e.g. a combination of
FirstName/LastName/address? Or FirstName/LastName/phone? Or
FirstName/LastName/email?
Yes. In table design, open the indexes Window, and add a new index. To
indicate that it is a single index with multiple fields, enter the fields on
consecutive rows, and leave the index name blank on all but the first row.
With the first row selected, set the Unique property to Yes.
Or is it possible to allow this but to throw up an alert message? Warning
that this person is probably already in the database? TIA


Trap the Before Update event on the form, and do a search for existing records
with the same combination of values. I recommend using a parameter query for
the search, so you don't have to worry about checking for quote characters,
etc.
Nov 12 '05 #2
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I'd recommend making a Primary Key instead of a unique index (I know,
same animal, different name) since Primary Keys were meant to do that.

I usually use the Form_Error procedure to trap duplicate record
errors. I've also used the "check before saving" method to do some
fancy work arounds if the user is entering a duplicate record (tell
user the record already exists - asking if they want to see it -
reloading form w/ existing record if they say yes).

HTH,

MGFoster:::mgf
Oakland, CA (USA)
-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBP8T5uoechKqOuFEgEQL7nACeMpzzIbcY0FvEicB+rSOQkt nIPcYAn31+
veFAxqLW19tEEOPddyYCRful
=J/gd
-----END PGP SIGNATURE-----

Steve Jorgensen wrote:
On Wed, 26 Nov 2003 12:30:01 -0500, "Catherine Jo Morgan" <cj******@hemc.net>
wrote:

Can I set it up so that a certain combination of fields can't contain the
same entries, on another record? e.g. a combination of
FirstName/LastName/address? Or FirstName/LastName/phone? Or
FirstName/LastName/email?

Yes. In table design, open the indexes Window, and add a new index. To
indicate that it is a single index with multiple fields, enter the fields on
consecutive rows, and leave the index name blank on all but the first row.
With the first row selected, set the Unique property to Yes.

Or is it possible to allow this but to throw up an alert message? Warning
that this person is probably already in the database? TIA

Trap the Before Update event on the form, and do a search for existing records
with the same combination of values. I recommend using a parameter query for
the search, so you don't have to worry about checking for quote characters,
etc.


Nov 12 '05 #3
no****@nospam.nospam (Steve Jorgensen) wrote in
<a2********************************@4ax.com>:
On Wed, 26 Nov 2003 12:30:01 -0500, "Catherine Jo Morgan"
<cj******@hemc.net> wrote:
Can I set it up so that a certain combination of fields can't
contain the same entries, on another record? e.g. a combination
of FirstName/LastName/address? Or FirstName/LastName/phone? Or
FirstName/LastName/email?


Yes. In table design, open the indexes Window, and add a new
index. To indicate that it is a single index with multiple
fields, enter the fields on consecutive rows, and leave the index
name blank on all but the first row. With the first row selected,
set the Unique property to Yes.


Well, theoretically, that's a nice-sounding idea, but in reality,
you'll end up with Nulls in some of the fields, which means you
can't really have a unique index.
Or is it possible to allow this but to throw up an alert message?
Warning that this person is probably already in the database? TIA


Trap the Before Update event on the form, and do a search for
existing records with the same combination of values. I recommend
using a parameter query for the search, so you don't have to worry
about checking for quote characters, etc.


I don't think this kind of thing can be accomplished with indexes
for people records. First off, addresses, phone numbers and email
addresses really oughtn't be stored in the same table as the name,
etc., so you wouldn't have that information available to you until
after you've created the person record. You can't have a unique
index on name, as there are plenty of cases where people share
exactly the same name.

I accomplish this by using an unbound form to add people. When you
enter the first name and last name, you have to click a CHECK FOR
DUPLICATES button before you the ADD>> button is actually enabled.
That reveals a subform that lists close matches (based on various
combinations of LIKE matches and Soundex and Soundex2 matches), and
allows you to look at the close matches and determine if they are
the same person. If so, there's a command button that abandons the
add and takes you to the selected duplicate record.

This works pretty well, but it is dependent on the users actually
reading what's onscreen.

But I don't know any other solution that would not prohibit valid
data entry.

I've been intending to package this up as a sample database for
ages, but just haven't had the time.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 12 '05 #4
I disagree because 95% of the time, the primary key should be an Autoincrement
field, though as you say, it doesn't matter much which one is the primary key,
and which one is a unique index.

On Wed, 26 Nov 2003 19:06:31 GMT, MGFoster <me@privacy.com> wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I'd recommend making a Primary Key instead of a unique index (I know,
same animal, different name) since Primary Keys were meant to do that.

I usually use the Form_Error procedure to trap duplicate record
errors. I've also used the "check before saving" method to do some
fancy work arounds if the user is entering a duplicate record (tell
user the record already exists - asking if they want to see it -
reloading form w/ existing record if they say yes).

HTH,

MGFoster:::mgf
Oakland, CA (USA)
-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBP8T5uoechKqOuFEgEQL7nACeMpzzIbcY0FvEicB+rSOQkt nIPcYAn31+
veFAxqLW19tEEOPddyYCRful
=J/gd
-----END PGP SIGNATURE-----

Steve Jorgensen wrote:
On Wed, 26 Nov 2003 12:30:01 -0500, "Catherine Jo Morgan" <cj******@hemc.net>
wrote:

Can I set it up so that a certain combination of fields can't contain the
same entries, on another record? e.g. a combination of
FirstName/LastName/address? Or FirstName/LastName/phone? Or
FirstName/LastName/email?

Yes. In table design, open the indexes Window, and add a new index. To
indicate that it is a single index with multiple fields, enter the fields on
consecutive rows, and leave the index name blank on all but the first row.
With the first row selected, set the Unique property to Yes.

Or is it possible to allow this but to throw up an alert message? Warning
that this person is probably already in the database? TIA

Trap the Before Update event on the form, and do a search for existing records
with the same combination of values. I recommend using a parameter query for
the search, so you don't have to worry about checking for quote characters,
etc.


Nov 12 '05 #5
On Wed, 26 Nov 2003 21:12:59 GMT, dX********@bway.net.invalid (David W.
Fenton) wrote:
no****@nospam.nospam (Steve Jorgensen) wrote in
<a2********************************@4ax.com>:
On Wed, 26 Nov 2003 12:30:01 -0500, "Catherine Jo Morgan"
<cj******@hemc.net> wrote:
Can I set it up so that a certain combination of fields can't
contain the same entries, on another record? e.g. a combination
of FirstName/LastName/address? Or FirstName/LastName/phone? Or
FirstName/LastName/email?
Yes. In table design, open the indexes Window, and add a new
index. To indicate that it is a single index with multiple
fields, enter the fields on consecutive rows, and leave the index
name blank on all but the first row. With the first row selected,
set the Unique property to Yes.


Well, theoretically, that's a nice-sounding idea, but in reality,
you'll end up with Nulls in some of the fields, which means you
can't really have a unique index.


Doh - right - what he said.
I accomplish this by using an unbound form to add people. When you
enter the first name and last name, you have to click a CHECK FOR
DUPLICATES button before you the ADD>> button is actually enabled.
That reveals a subform that lists close matches (based on various
combinations of LIKE matches and Soundex and Soundex2 matches), and
allows you to look at the close matches and determine if they are
the same person. If so, there's a command button that abandons the
add and takes you to the selected duplicate record.

This works pretty well, but it is dependent on the users actually
reading what's onscreen.


I forgot about this when replying to the message originally, but a similar
idea I picked up from the spec for a system I did recently was that the add
and search screens are the same, and you can't do an add without first doing a
search that must include certain fields. When you then select the new record
option, the search values are filled in as the defaults for the new record.

I guess you could call it a "find-or-add" model.

My implementation of that model had a form split into 3 sections. A short top
section contains the search parameter controls and the "Find" button. The
bottom section is split left/right with the search results listbox on the
left, and an add/edit subform on the right. The listbox is based on a union
query with a <<New Record>> row added at the bottom. The subform uses the
listbox selection as its master link, and on after update of the listbox, the
AllowAdditions property of the subform is set to True of False depending on
whether the new record selection is chosen.
Nov 12 '05 #6
Could you enlighten me. OK I agree that addresses can well be held in an
address table, but what is the advantage of holding phone nos or email
addresses in another table, unless there is a possibility of multiple phones
or e-mail addresses. Unlikely with a Club other than a mobile and land line.

Phil
"David W. Fenton" <dX********@bway.net.invalid> wrote in message
news:94***************************@24.168.128.74.. .
no****@nospam.nospam (Steve Jorgensen) wrote in
<a2********************************@4ax.com>:
On Wed, 26 Nov 2003 12:30:01 -0500, "Catherine Jo Morgan"
<cj******@hemc.net> wrote:
Can I set it up so that a certain combination of fields can't
contain the same entries, on another record? e.g. a combination
of FirstName/LastName/address? Or FirstName/LastName/phone? Or
FirstName/LastName/email?


Yes. In table design, open the indexes Window, and add a new
index. To indicate that it is a single index with multiple
fields, enter the fields on consecutive rows, and leave the index
name blank on all but the first row. With the first row selected,
set the Unique property to Yes.


Well, theoretically, that's a nice-sounding idea, but in reality,
you'll end up with Nulls in some of the fields, which means you
can't really have a unique index.
Or is it possible to allow this but to throw up an alert message?
Warning that this person is probably already in the database? TIA


Trap the Before Update event on the form, and do a search for
existing records with the same combination of values. I recommend
using a parameter query for the search, so you don't have to worry
about checking for quote characters, etc.


I don't think this kind of thing can be accomplished with indexes
for people records. First off, addresses, phone numbers and email
addresses really oughtn't be stored in the same table as the name,
etc., so you wouldn't have that information available to you until
after you've created the person record. You can't have a unique
index on name, as there are plenty of cases where people share
exactly the same name.

I accomplish this by using an unbound form to add people. When you
enter the first name and last name, you have to click a CHECK FOR
DUPLICATES button before you the ADD>> button is actually enabled.
That reveals a subform that lists close matches (based on various
combinations of LIKE matches and Soundex and Soundex2 matches), and
allows you to look at the close matches and determine if they are
the same person. If so, there's a command button that abandons the
add and takes you to the selected duplicate record.

This works pretty well, but it is dependent on the users actually
reading what's onscreen.

But I don't know any other solution that would not prohibit valid
data entry.

I've been intending to package this up as a sample database for
ages, but just haven't had the time.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc

Nov 12 '05 #7
Actually, it is not unlikely with a club, especially these days.

On Wed, 26 Nov 2003 23:08:46 -0000, "Phil Stanton" <ph**@stantonfamily.co.uk>
wrote:
Could you enlighten me. OK I agree that addresses can well be held in an
address table, but what is the advantage of holding phone nos or email
addresses in another table, unless there is a possibility of multiple phones
or e-mail addresses. Unlikely with a Club other than a mobile and land line.

Phil
"David W. Fenton" <dX********@bway.net.invalid> wrote in message
news:94***************************@24.168.128.74. ..
no****@nospam.nospam (Steve Jorgensen) wrote in
<a2********************************@4ax.com>:
>On Wed, 26 Nov 2003 12:30:01 -0500, "Catherine Jo Morgan"
><cj******@hemc.net> wrote:
>
>>Can I set it up so that a certain combination of fields can't
>>contain the same entries, on another record? e.g. a combination
>>of FirstName/LastName/address? Or FirstName/LastName/phone? Or
>>FirstName/LastName/email?
>
>Yes. In table design, open the indexes Window, and add a new
>index. To indicate that it is a single index with multiple
>fields, enter the fields on consecutive rows, and leave the index
>name blank on all but the first row. With the first row selected,
>set the Unique property to Yes.


Well, theoretically, that's a nice-sounding idea, but in reality,
you'll end up with Nulls in some of the fields, which means you
can't really have a unique index.
>>Or is it possible to allow this but to throw up an alert message?
>>Warning that this person is probably already in the database? TIA
>
>Trap the Before Update event on the form, and do a search for
>existing records with the same combination of values. I recommend
>using a parameter query for the search, so you don't have to worry
>about checking for quote characters, etc.


I don't think this kind of thing can be accomplished with indexes
for people records. First off, addresses, phone numbers and email
addresses really oughtn't be stored in the same table as the name,
etc., so you wouldn't have that information available to you until
after you've created the person record. You can't have a unique
index on name, as there are plenty of cases where people share
exactly the same name.

I accomplish this by using an unbound form to add people. When you
enter the first name and last name, you have to click a CHECK FOR
DUPLICATES button before you the ADD>> button is actually enabled.
That reveals a subform that lists close matches (based on various
combinations of LIKE matches and Soundex and Soundex2 matches), and
allows you to look at the close matches and determine if they are
the same person. If so, there's a command button that abandons the
add and takes you to the selected duplicate record.

This works pretty well, but it is dependent on the users actually
reading what's onscreen.

But I don't know any other solution that would not prohibit valid
data entry.

I've been intending to package this up as a sample database for
ages, but just haven't had the time.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc


Nov 12 '05 #8
ph**@stantonfamily.co.uk (Phil Stanton) wrote in
<3f***********************@mercury.nildram.net>:
Could you enlighten me. OK I agree that addresses can well be held
in an address table, but what is the advantage of holding phone
nos or email addresses in another table, unless there is a
possibility of multiple phones or e-mail addresses. Unlikely with
a Club other than a mobile and land line.


Ha, ha, ha, ha, ha, ha, ha, ha!!!!

Boy, that one had me laughing.

I've not had an app in years that didn't need (note that I store
email and phone in the same table):

Home
Home Fax
Mobile
Home Email
Work
Work 2
Work Fax
Work Email

Some add a second mobile number and a pager number.

That many phone fields onscreen takes up a lot of space. I utilize
an outer join to populate all the possibilities, as in this screen
shot:

http://www.bway.net/~dfassoc/example...ontactInfo.jpg

I find that clients like to see the choices laid out for them
rather than to have to pick from a dropdown list. I also find that
the method used in Outlook, for instance, is difficult, because
most users will never notice that there are other types of numbers
that are recordable.

In that screenshot, there are two subforms, one for phones and one
for email. The phone types are categorized by Office or Phone in a
lookup table linked by PhoneTypeID. The subforms are filtered on
the PersonID and the tag of the subform object. That is, the
subform object for the home phones and home email form controls on
the parent form have a tag "Home" and is linked with:

LinkChildFields = "PhoneType"

The record source uses an outer join to a subquery that filters by
the PersonID of the parent form.

I use this kind of thing in all my apps these days. Adding a phone
type does not require much restructuring at all, just adding to the
phone types table and resizing the subform controls, which is a lot
easier than adding fields, changing recordsources and then finding
enough room for additional fields (though that's pretty much equal
between the two approaches if you lay it out right).

And every client that I've implemented this for has added at least
one phone type after the app was in production, precisely because
they knew it was possible without much trouble.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 12 '05 #9
Actually, my design puts People, Addresses, and Comms in separate tables,
with junction tables between People/Addresses and People/Comms. I just sort
of took this for granted as the best way to do it. People with PO Box
mailing addresses need a second address for UPS or FedEx shipments. Also
some people have two homes. Re Comms - I'd have a lot of blank fields in
most People records if I tried to add a field for every possible CommType
like email, cellphone, home phone, work phone, etc.

"Phil Stanton" <ph**@stantonfamily.co.uk> wrote in message
news:3f***********************@mercury.nildram.net ...
Could you enlighten me. OK I agree that addresses can well be held in an
address table, but what is the advantage of holding phone nos or email
addresses in another table, unless there is a possibility of multiple phones or e-mail addresses. Unlikely with a Club other than a mobile and land line.
Phil
"David W. Fenton" <dX********@bway.net.invalid> wrote in message
news:94***************************@24.168.128.74.. .
no****@nospam.nospam (Steve Jorgensen) wrote in
<a2********************************@4ax.com>:
On Wed, 26 Nov 2003 12:30:01 -0500, "Catherine Jo Morgan"
<cj******@hemc.net> wrote:

>Can I set it up so that a certain combination of fields can't
>contain the same entries, on another record? e.g. a combination
>of FirstName/LastName/address? Or FirstName/LastName/phone? Or
>FirstName/LastName/email?

Yes. In table design, open the indexes Window, and add a new
index. To indicate that it is a single index with multiple
fields, enter the fields on consecutive rows, and leave the index
name blank on all but the first row. With the first row selected,
set the Unique property to Yes.


Well, theoretically, that's a nice-sounding idea, but in reality,
you'll end up with Nulls in some of the fields, which means you
can't really have a unique index.
>Or is it possible to allow this but to throw up an alert message?
>Warning that this person is probably already in the database? TIA

Trap the Before Update event on the form, and do a search for
existing records with the same combination of values. I recommend
using a parameter query for the search, so you don't have to worry
about checking for quote characters, etc.


I don't think this kind of thing can be accomplished with indexes
for people records. First off, addresses, phone numbers and email
addresses really oughtn't be stored in the same table as the name,
etc., so you wouldn't have that information available to you until
after you've created the person record. You can't have a unique
index on name, as there are plenty of cases where people share
exactly the same name.

I accomplish this by using an unbound form to add people. When you
enter the first name and last name, you have to click a CHECK FOR
DUPLICATES button before you the ADD>> button is actually enabled.
That reveals a subform that lists close matches (based on various
combinations of LIKE matches and Soundex and Soundex2 matches), and
allows you to look at the close matches and determine if they are
the same person. If so, there's a command button that abandons the
add and takes you to the selected duplicate record.

This works pretty well, but it is dependent on the users actually
reading what's onscreen.

But I don't know any other solution that would not prohibit valid
data entry.

I've been intending to package this up as a sample database for
ages, but just haven't had the time.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc


Nov 12 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: ColinWard | last post by:
I am using the following code to validate that the person that is being entered into the database does not already exist. However wnem I test it by entering myself as a contact(I first checked that...
4
by: KT | last post by:
Is there any one click solution that would do the trick? I would like to create a button, so the person who maintains the database can perform clean up work to delete duplicate records which...
4
by: suffrinmick | last post by:
Hi everyone! I (Along with the help of some of you guys!) have managed to get a query working which takes multiple values (types of organisation) from a list box. The query returns a list of...
2
by: Emilio Jimonerz | last post by:
Hello. I am developing a project tracking database that records the following information: 1. Project name 2. Lead person(s) 3. Support person(s) 4. Clients 5. Contacts The data is organized...
8
by: Iona | last post by:
Hi Allan, I'm using a nifty piece of code you put on here some time back to do a duplicate entry check as below. I'm using to check for duplicate names. However I am getting an error message on...
1
by: charliej2001 | last post by:
Hi all My access database has import/export capabiltiy of contact details between outlook. The database is getting big now (1000+ contacts) and so are the outlook address books that have the...
11
by: ariel81 | last post by:
i have created a function to input data from four textboxes into a table. how do i prevent duplicate records of the same mth/Yr into the table? editing of the data in the table with reference to the...
1
by: rgurganus | last post by:
I'm trying to setup a way to find possible duplicate or near-duplicate records of contact people. I have a table of 50k records doing an inner join with itself, something like this: SELECT...
4
by: jbrumbau | last post by:
Hello, I have been successfully using a database I've created for several months to populate an equipment list for a project we've been working on. However, the form has recently stopped working...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.