473,587 Members | 2,505 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 5037
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.goo gle.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

Nov 12 '05 #2
jo***********@s ocal.rr.com (Josh Armstrong) wrote in message news:<b6******* *************** ****@posting.go ogle.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,Sys Num) 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,Sys Num) 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
1830
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) For cntr = lbDwgList.Items.Count - 1 To 1 Step -1 ' If next item is a duplicate -> Remove It If lbDwgList.Items(cntr) = lbDwgList.Items(cntr - 1)...
5
2125
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
3921
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 this line: Set rs = db.OpenRecordset("SELECT ID FROM Contacts WHERE (" & sWhere & ");") Contacts being the main table. I am using access 2003...
4
2139
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 a simple function that checks the times for duplicates. I wanted to check for a duplicate before it writes to the listbox by returning a boolean...
4
2640
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 uploaded. Event the document created date, modified date, filename can be different. How to find the document is duplidate. What i did is, i...
11
5993
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.. thanks Code Below: Private Sub btnADD_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnADD.Click strSQL = "INSERT...
3
2385
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 have a database that manages bookings in four banquet halls. It was running in an Access database, but two years ago, I migrated it to SQL server....
40
17963
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. How would I go about this... I have the array reading a file correctly is it just the check for duplicates that I am stuck on... :)
1
2151
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 same sheet) and external duplicates (duplicates which exist outside this sheet). I have gone through lot of logics..some of which are ... -...
0
7920
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8215
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8347
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7973
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6626
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5718
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3879
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2358
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1189
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.