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

Home Posts Topics Members FAQ

How To Avoid Duplicate Records In Ms-access.

81 New Member
HI,

I am having a database in access. Where user imports various data which is in excel format. I want them to stop importing any duplicate record. If any duplicate record is been trying to import by user, access should generate an error files saying record already exists. Kindly suggest how to go ahead.

Thanx in advance
Anup
Jul 23 '08 #1
3 9579
Stewart Ross
2,545 Recognized Expert Moderator Specialist
Hi Anup. Access will automatically refuse to import or accept duplicates as long as the relationship between tables is defined and referential integrity set between those tables. Duplicate records would violate referential integrity. Access's own error messages to users about such violations are low-level and not user-friendly, so developers would normally replace these with their own.

If you are looking to block duplicates on a table that does not relate to any other you can do so by defining the field or fields which make up the primary key for that table, as there can be no duplicates of primary keys.

It all comes down to ensuring tables are correctly defined, with appropriate primary keys (not just autonumber values if possible).

-Stewart
Jul 23 '08 #2
smugcool
81 New Member
Hi Anup. Access will automatically refuse to import or accept duplicates as long as the relationship between tables is defined and referential integrity set between those tables. Duplicate records would violate referential integrity. Access's own error messages to users about such violations are low-level and not user-friendly, so developers would normally replace these with their own.

If you are looking to block duplicates on a table that does not relate to any other you can do so by defining the field or fields which make up the primary key for that table, as there can be no duplicates of primary keys.

It all comes down to ensuring tables are correctly defined, with appropriate primary keys (not just autonumber values if possible).

-Stewart

Thanx Stewart for your prompt reply.

My problem is that I want to avoid those duplicates which is having same value for all fields. consider below example:-
Suppose Field 1 contains A ,Field2 contains B and Field3 contains C...... etc.

If I import Field1 and field2 with similar values access should accept it and should not throw any errors.

But when I will upload all the fields i.e. Field1, field2 and field3..... with same values, then access should deny accepting it. My table does have any relationship with any other table.

Since I cant make primary keys to any field as I am accepting duplicates where some of the fields are matching in the table. But i want all the fields with similar value matched access should avoid it.
Jul 23 '08 #3
Stewart Ross
2,545 Recognized Expert Moderator Specialist
Hi Anup. If it is the case that to define a record as a duplicate you must look at all fields in the record - then in the table design you should set those fields together as the (compound) primary key for that table.

Designing relational tables is about identifying what makes a record unique; if that requires that all fields are part of the primary key, so be it. There is an excellent article on Database Normalisation and Table Design in our howto section.

Otherwise, you have few options. The only other that occurs to me is to use form data entry and run VBA code from the Before Update event of the form to check for duplicates - getting very messy indeed.

-Stewart
Jul 23 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Carroll | last post by:
I'm looking for a way in SQL to find duplicate records in a single table, that are the same based on 3 columns, regardless of what is in the other columns in the duplicate records. I would like to...
2
by: nethravathy | last post by:
Hi, The following table namely elcbtripselect contains 5147 records.I want to know wether this table contains duplicate records or not. I tried with following query 1)SELECT...
5
by: ramab | last post by:
Hi. There are two fields in my table that i check so that both of them doesnt occur together again to create a duplicate record. My problem is that if one of the field loses focus then i am able to...
3
by: audj | last post by:
Hello, I am trying to use a subquery to avoid duplicate entries when someone submits a form to subscribe to a mailing list. So I want to check if the email exists before adding the record. ...
5
by: mercea | last post by:
hi all, How do i avoid duplicate records on my database? i have 4 textboxes that collect user information and this information is saved in the database. when a user fills the textboxes and clicks...
1
by: colin-whitehead | last post by:
I have 2 tables tblReports primary key UPN, plus numeric fields Effort, Attain, etc tblComments numeric primary key ID & textfield Text In the Query I select each record from tblReports...
2
by: mtgriffiths86 | last post by:
Hi All, What i am trying to do is avoid inserting duplicate records into a database. I am inserting the records using a webpage but when i enter a flight number(primary key) that already exists i...
4
by: Thomas Arthur Seidel | last post by:
Hello to all, I have a small or big problem with a customer data base, where during a change of system we might have created duplicate records. This should be easy to find, you might think, but,...
2
by: nomvula | last post by:
hi guys i need some help to duplicate records on my form datasheet: here's the example of my form results: ClientLookup DateCaptured ForecastDate Description ForecastQuantity Forecast Actual UJ...
8
by: santhanalakshmi | last post by:
Hi, I am using SQL Server 2000. I am not using any Primary Keys in my table. Table Fields: rollno crseid semester period s1 61820 01 JUL-NOV...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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: 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
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.