473,407 Members | 2,312 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,407 software developers and data experts.

check for duplicates

I need a form to check for duplicates before a new record is added.
Table name: Links
Field1: LinkSysNum
Field2: SysNum

For example, [LinkSysNum]=539 is linked to [SysNum]=540
[SysNum]=544

The db is setup using a union query to cross link the records. The
form needs to be able to look at the record it is about to create and
if it finds that it is already there give a msg.

Thanks
Nov 12 '05 #1
3 5003
TC
Say the user types the potentially duplicated value into a textbox.

Use a DLookup() function in the BeforeUpdate event of that textbox. If the
DLookup() finds an exsting record, it can display a message using the
Msgbox() function, then set the Cancel parameter for the BeforeUpdate event.
This will stop the form accepting that value.

HTH,
TC
"Josh Armstrong" <jo***********@socal.rr.com> wrote in message
news:b6**************************@posting.google.c om...
I need a form to check for duplicates before a new record is added.
Table name: Links
Field1: LinkSysNum
Field2: SysNum

For example, [LinkSysNum]=539 is linked to [SysNum]=540
[SysNum]=544

The db is setup using a union query to cross link the records. The
form needs to be able to look at the record it is about to create and
if it finds that it is already there give a msg.

Thanks

Nov 12 '05 #2
jo***********@socal.rr.com (Josh Armstrong) wrote in message news:<b6**************************@posting.google. com>...
I need a form to check for duplicates before a new record is added.
Table name: Links
Field1: LinkSysNum
Field2: SysNum

For example, [LinkSysNum]=539 is linked to [SysNum]=540
[SysNum]=544

The db is setup using a union query to cross link the records. The
form needs to be able to look at the record it is about to create and
if it finds that it is already there give a msg.

Thanks


If the two fields (LinkSysNum,SysNum) comprise, the primary key, then
you *cannot* add duplicates. Why not make use of what the database
will do for you instead of making work for yourself?
Nov 12 '05 #3
> > I need a form to check for duplicates before a new record is added.
Table name: Links
Field1: LinkSysNum
Field2: SysNum

For example, [LinkSysNum]=539 is linked to [SysNum]=540
[SysNum]=544

The db is setup using a union query to cross link the records. The
form needs to be able to look at the record it is about to create and
if it finds that it is already there give a msg.

Thanks


If the two fields (LinkSysNum,SysNum) comprise, the primary key, then
you *cannot* add duplicates. Why not make use of what the database
will do for you instead of making work for yourself?

I thought about that, but the 2 fields do not make up the primary key.
I was not able to do that as it is set up such that
Record A is linked to Record B
If you look at Record B you will see A and vis-versa

If you Start will B and add the Link to A then you now have a dupe
record.
AB
BA

I need to check for both before saving the new record.
Nov 12 '05 #4

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

Similar topics

5
by: Mr. B | last post by:
The following code is how I check for duplicates in a List box. This is simple enough as there is only one column of stuff to check. ' Check for Duplicates ' Search listbox (from last to first)...
5
by: Jerry | last post by:
Say a record has 15 fields. Is there a better way to check for a duplicate when entering a new record than fourteen "Ands" in the where clause of DCount or FindFirst? Thanks, Jerry
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...
4
geo039
by: geo039 | last post by:
I tried to write a simple application that takes user input by text and time selected by date time picker. It displays the appt description in one list box and the time in another list box. I wrote...
4
by: giftson.john | last post by:
Hi, I am creating an application which migrates all documents from one repository to another repository. Before migration i have to verify all the documents are unique. No duplicates has to be...
11
by: richardkreidl | last post by:
I'm trying to check for duplicates before I do an INSERT into the Access database table. I basically want to alert the user if the 'ProjectName' and the 'MileStones' are already in the table.. ...
3
by: Lester | last post by:
I'm driving myself crazy with a problem in trying to translate a query written for Access to that for SQL server. I would think that I would use a trigger, but am not sure how to set it up. We...
40
by: kylie991 | last post by:
Hi I am stuck on checking if a 2D array has duplicates. I have to write a function to check if a column has duplicates and then another function to check if the rows have duplicates from a file. ...
1
by: tskmjk55 | last post by:
Recently, I have a requirement to develop a vb.net application wherein the input excel sheet data which has an average of 5000 records should be checked for Internal duplicates (duplicates within the...
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?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
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,...

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.