473,378 Members | 1,334 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Help Detecting a Duplicate entry on a Form

1
I have a Table for certain product, there is Two product type (Regular and Reinforced) Each has their independent serial number and I want to be able to display an error if the serial number has already been added.
I have no experience with MS Access but I been reading a lot but I cannot figure this out.

Thanks

PS
Feb 20 '12 #1
1 1282
NeoPa
32,556 Expert Mod 16PB
First off, the thing to do is to ensure this can never happen by designing the table such that the unique field has a unique index. Such a design will ensure that Access never allows such data to be entered in the first place.

Of course, if the dodgy data is already there and in place, you need to find it. A query can help with that. If you link set criteria in the query to ensure only [ID]s where the Count() of those [ID]s is greater than one are included. The example SQL below illustrates the idea :
Expand|Select|Wrap|Line Numbers
  1. SELECT [ID]
  2.      , [Name]
  3. FROM   [YourTable]
  4. WHERE  [ID] In(SELECT   [ID]
  5.                FROM     [YourTable]
  6.                GROUP BY [ID]
  7.                HAVING   Count(*) > 1)
Feb 20 '12 #2

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

Similar topics

0
by: Geetu | last post by:
I am trying to jar up a file and getting this exception, not sure what could be wrong. The same piece of code works fine in few machines but there is one machine where this piece of code gives this...
0
by: jjliu | last post by:
i have a table with two fields (id and myfield). id is a primary key not nll auto_increment, and myfield is set as unique... Due to unique setting for myfield, if i try to insert the duplicate...
0
by: Gary Lundquest | last post by:
I have an application with MS Access 2000 as the front end and MySQL as the back end. All was well until I upgraded the MySQL (Linux) server. The Problem: I insert data into a cumulative table....
1
by: Joseph Chase | last post by:
I am running version 4.1.13a-log on a Mac XServe. How can I receive a 'duplicate entry' error for an UPDATE? An update isn't creating an entry, so why this error message? ...
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...
3
by: deepaks85 | last post by:
Dear Sir, I have setup a SQL database with PHP. Whenever I am trying to insert the data into my database it gives me error : 'Duplicate entry for key 2'. Please help me sir. I am sending you...
5
by: baur79 | last post by:
Hi guys i try to run this code in loop and to pass even the entry is duplicated def email_insert_in_db(email): sql="INSERT INTO emails (email) values ('%s') "%(email)...
2
by: eazyone | last post by:
I can prevent a duplicate ID from being entered, but can't figure out how to go to that specific record. I keep getting an error message on: Me.Bookmark = rsc.Bookmark Its not opening and...
1
by: chicago1985 | last post by:
I have a unique constraint in my Oracle table for 3 fields. If I enter duplicate info on the table using Oracle client I will get an Ora message error ORA-00001 that tells me it is a duplicate entry...
2
by: olcaygul | last post by:
hii i´m learning jsp and html with sql and i´m beginer on it, i have the table andcodes below in mysql and jsp, i´m working on html and jsp with netbeans IDE 3.6. of course if i try to insert any...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.