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

check duplicated records from 2 table

P: 25
I'm trying to check for duplicates from 2 table based on 2 fields. For example if the year and month is the same for table A and Table B then i will not import the record from Table B to Table A. But i have no idea how to do so. I have this and it has an error.

If DCount("*", "[All_part Report]", ([All_part Report].[Month] = [Temp].[Month])) > 0 Then
MsgBox "This is a duplicate"


Pleeeeaaase and THANK YOU!
Sep 10 '07 #1
Share this Question
Share on Google+
3 Replies


JKing
Expert 100+
P: 1,206
The last parameter also needs to be a string.

Expand|Select|Wrap|Line Numbers
  1. If DCount("*", "[All_part Report]", "[All_part Report].[Month] = [Temp].[Month]") > 0 Then
  2.  
Sep 10 '07 #2

P: 25
The last parameter also needs to be a string.

Expand|Select|Wrap|Line Numbers
  1. If DCount("*", "[All_part Report]", "[All_part Report].[Month] = [Temp].[Month]") > 0 Then
  2.  
Hey JKing

I used the code you give me but it returns me an error '2001'

Why is this so?
Sep 10 '07 #3

JKing
Expert 100+
P: 1,206
I think the problem is you're trying to draw data from more than one table within your criteria string.

My suggestion is to either use the built-in wizard for finding duplicate information in tables. You can get to the wizard by going to Tools > Analyze > Tables

The other idea is to write a query rather than use DCount.
Sep 10 '07 #4

Post your reply

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