By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,847 Members | 2,402 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,847 IT Pros & Developers. It's quick & easy.

VBA Code to find Duplicates in a Access Table

P: 77
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
Share this Question
Share on Google+
3 Replies


P: 57
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

P: 77
Could you please explain your answer a little more...What do you mean by docmd.openquery ?
Nov 6 '07 #3

P: 57
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

Post your reply

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