473,770 Members | 1,870 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

VBA Code to find Duplicates in a Access Table

77 New Member
Please help with writing a VBA Code to find duplicates from the following acces table.

Fields:- TranDate, Job Num, Agency Name

Date is like this,

1/3/2003, 757702, People Office
1/3/2003, 762041, People Office
1/6/2003, 815643, Standard Services Inc
1/6/2003, 641502, Excellent Draft Solutions
11/19/2005, 237352, Second Party
11/19/2005, 237352, Second Level Party

This is the logic I need the code to do,

First it should read a TranDate and look for any duplicates in the whole table, if found, check if their Job Nums are same too. If the Job Nums are same then mark them as duplicates.

Please help
Nov 5 '07 #1
3 5564
DThreadgill
57 New Member
Please help with writing a VBA Code to find duplicates from the following acces table.

Fields:- TranDate, Job Num, Agency Name

Date is like this,

1/3/2003, 757702, People Office
1/3/2003, 762041, People Office
1/6/2003, 815643, Standard Services Inc
1/6/2003, 641502, Excellent Draft Solutions
11/19/2005, 237352, Second Party
11/19/2005, 237352, Second Level Party

This is the logic I need the code to do,

First it should read a TranDate and look for any duplicates in the whole table, if found, check if their Job Nums are same too. If the Job Nums are same then mark them as duplicates.

Please help
You can use the Find Duplicates query wizard and then write a docmd.openquery to reference that query.
Nov 5 '07 #2
AccessHunter
77 New Member
Could you please explain your answer a little more...What do you mean by docmd.openquery ?
Nov 6 '07 #3
DThreadgill
57 New Member
Could you please explain your answer a little more...What do you mean by docmd.openquery ?
Write your query (Find Duplicates query wizard) and name it (ex. qry_dups). In VBA you can use the docmd.openquery (docmd = do command and the command you're doing is opening a query). DoCmd.OpenQuery "qry_dups", acViewNormal, acEdit
Nov 6 '07 #4

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

Similar topics

3
4612
by: Tom Mitchell | last post by:
All: I'm stumped on a query. How do I find duplicates in a table where one of the duplicates has values is a certain field and the other doesn't. For example, I have the following table: tblItems ItemID ItemLabel
1
1675
by: MHenry | last post by:
Hi, I have a table with duplicate records. Some of the duplicates need to be eliminated from the table and some need not. A duplicate record does not need to be eliminated if the one record appears multiple times on one employee's report. However, if the same record(s) appear on any other employee's report, it means they collaborated on the item, and the item from the second employee's report should be eliminated from the table.
18
18419
by: Dixie | last post by:
Can I set the Format property in a date/time field in code? Can I set the Input Mask in a date/time field in code? Can I set the Format of a Yes/No field to Checkbox in code? I am working on a remote update of tables and fields and can't find enough information on these things. Also, how do you index a field in code?
16
4185
by: tyrfboard | last post by:
I've been searching for awhile now on how to remove duplicates from a table within an Access db and have found plenty of articles on finding or deleting duplicates. All I want to do is remove them from within an SQL query - leaving one of the records behind of course. I have a mailing list comprised of a union query that gets records from two separate tables. I want to be able to run a query that removes one (or more) of the duplicated...
4
2480
by: Killer42 | last post by:
Hi all. Sorry, this is probably a really simple one but I'm having some difficulty with it, and don't have much time to devote to it right now. I need to find all the records which have duplicates (on two fields) in another table. In Access 2003, the "Find duplicates wizard" will produce a query to list duplicates within the one table, but what about when they're in a different one? In other words, I want to select all records in table...
7
4539
by: john | last post by:
In my form I have a master table and a details table linked 1xM. I can search through the whole parent table but I also like to be able to search through the child table fields to find parent records. Should I design a new form for this or can I somehow make this work in the same form. Thanks in advance, john
3
2851
by: ryan.paquette | last post by:
In the table there are 2 fields in which I wish to limit (i.e. No Duplicates) Although I do not want to limit them to "No Duplicates" separately. I need them to be limited to "No Duplicates" as if they were one field. The 2 fields are "Employee_Name" & "Training_Course". *(There is another table for Employees & another for Training Courses, both of which are related to this table.)
7
6864
by: john.cole | last post by:
I have searched all the groups I can, and I still haven't been able to come up the solution I need. I have the following problem. In my form named sbfrmSpoolList, I am entering a job, spool and revision number. My table is indexed properly to not allow duplicates, but I would like teh user to be notified that they are typing a duplicate via a message box, then I woulld the update of the record to be cancelled. I have tried the...
1
1573
by: stateemk | last post by:
I have an Access project and need to find duplicates in table. How do I create a query to find the duplicates?
0
9617
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
9453
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10254
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10036
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
9904
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
8929
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
7451
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
5354
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
4007
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

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.