473,624 Members | 1,993 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Prevent duplicate data entry in Access using VB.NET?

1 New Member
Hello guys,

I am reading a downloaded textfile which has a fields like date,NAV and Name using VB.NET. The date on which the textfile is downloaded remains the same.After each readline operation it looks into the Access DB (tablename:Deta ils) and updates the 3 columns(Date,NA V,Name).My question is how do i prevent the user accesing the already downloaded file or in other words how do i prevent my DB being loaded with duplicate values in VB.NET. Can anyone tell me how to go about it?
Aug 5 '08 #1
1 5012
janders468
112 Recognized Expert New Member
If I understand your question correctly you upload from a file which may or may not contain old information and you want to ensure that you don't reload information you already have.

You could do this with vb.net but I would probably use the database to enforce this as it can do so much more efficiently. That being said you will probably have to load the text file into a staging table which doesn't care about duplicates, then load the non duplicated table with the stage table data doing an outer join on the fields that make the table unique and only loading where the NonDupe_tbl values are null. Assume you have two tables Stage_tbl and NonDupe_tbl the sql would be as follows:
Expand|Select|Wrap|Line Numbers
  1. INSERT INTO NonDupe_tbl ( [Date], NAV, Name )
  2. SELECT Stage_tbl.Date, Stage_tbl.NAV, Stage_tbl.Name
  3. FROM Stage_tbl LEFT JOIN NonDupe_tbl ON (Stage_tbl.Name = NonDupe_tbl.Name) AND (Stage_tbl.NAV = NonDupe_tbl.NAV) AND (Stage_tbl.Date = NonDupe_tbl.Date)
  4. WHERE (((NonDupe_tbl.Date) Is Null) AND ((NonDupe_tbl.NAV) Is Null) AND ((NonDupe_tbl.Name) Is Null));
  5.  
  6.  
You can run the queries from vb but the database enforces the rules, which will be more efficient and probably less error prone.
Aug 6 '08 #2

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

Similar topics

2
1925
by: Pablo | last post by:
Hello, there, I have a table tblData which has pharmacy data. The table has following fields: ClaimNum, LineNum... The ClaimNum has claim number which is 12 characters. LineNum is NULL. The table looks like this ClaimNum LineNum abcde1234561 abcde1234561
14
2337
by: Ed Jay | last post by:
On a multi-textbox form, linked to an external js, I use onBlur to call: function chkNum(cellname) { var str = document.getElementById(cellname).value.toString(10); if (str < 28 || str > 36) {alert("Temperature entered is out of range."); return;} } I enter data into the first textbox and move the cursor to the second textbox. The function is properly called. Since textbox2 is empty, when I
0
1632
by: mmazid | last post by:
I would like to know how to prevent entering the same data as a primary key to an MS Access database and return with an error message confirming the data already exists in ASP.Net (VB.Net). Function AddFault(ByVal faultID As Integer, ByVal username As String, ByVal title As String, ByVal desc As String) As Integer Dim connectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0; Ole DB Services=-4; Data Source=C:\Documents an"& _ "d...
8
3925
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 The error message states that there are; Too few parameters. Expected 1 I have no idea how to...
2
3211
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 displaying the duplicate record, can anyone help? Here's a snipet of the code for before Update Private Sub RegNumber_BeforeUpdate(Cancel As Integer)
6
4540
by: teser3 | last post by:
I have my PHP inserting into Oracle 9i. But how do I prevent duplicate record entries? I only have 3 fields in the insert in the action page: CODE <?php $c=OCILogon("scott", "tiger", "orcl"); if ( ! $c ) { echo "Unable to connect: " . var_dump( OCIError() );
1
3383
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 attempt. How do I capture that in my PHP page if someone tries to enter duplicate record info? My PHP Oracle insert statement in the action page: $s = OCIParse($c, "insert into tableOne values ('$varOne', '$varTwo', '$varThree')");...
4
2153
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 for some unknown reason. I've been having a problem recently where one table (Project Info) keeps auto-incrementing when I try to create a new record with another table (Equipment Info). Only the Equipment table is supposed to grow. It used to never...
4
4113
by: AXESMI59 | last post by:
have a project in which I am entering Serial Numbers and Date codes into a Combo box. Serial numbers are all different. However, they could each have the same Date Code. Each Serial Number has a corresponding Date Code which I then write to a table using VBA. When I try to enter a duplicate date code, it automatically finds the duplicate and will not allow me to add it again to that combo box. How do I configure that combo box so I can enter the...
0
8236
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8621
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8475
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7159
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6110
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4079
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2606
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
1
1785
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1482
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.