Solved

Access 2010 Trying to find duplicate statements in a month

Posted on 2014-03-10
6
335 Views
Last Modified: 2014-03-10
I am trying to find duplicate statements that are entered in 1 month but the data entry may be off a day.  
Example: Statement Dates are 01/31/14, 02/28/14, 02/28/14, 03/30/14
          or  Statement Dates are 01/31/14, 02/28/14, 03/05/14, 03/30/14

I should only have 1 statement a month.  I wanted to try to create a field to convert the statement date to Month format, then look for duplicates in the month.

Fields:  
AccountID (Account Number)
StatementDate (Statement Date)

I tried:
Expr1: Format([StatementDate],"mmm")
0
Comment
Question by:NNiicckk
  • 3
  • 3
6 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 39918567
try this query

select AccountID,Count(Format([StatementDate],"yyyymm")) As Expr1,Count(Format([StatementDate],"yyyymm")) As expr2
from tableName
where Count(Format([StatementDate],"yyyymm"))>1
Group by AccountID,Count(Format([StatementDate],"yyyymm"))


or

select AccountID,Count(Format([StatementDate],"yyyymm")) As Expr1,Count(Format([StatementDate],"yyyymm")) As expr2
from tableName
Group by AccountID,Count(Format([StatementDate],"yyyymm"))
having Count(Format([StatementDate],"yyyymm"))>1
0
 

Author Comment

by:NNiicckk
ID: 39918680
It says I cannot have a aggregate funtion in GROUP BY clause (Count(Format([StatementDate],"yyyymm")))
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 39918711
oops sorry


select AccountID,Count(Format([StatementDate],"yyyymm")) As Expr1,Count(Format([StatementDate],"yyyymm")) As expr2
from tableName
where Count(Format([StatementDate],"yyyymm"))>1
Group by AccountID, Format([StatementDate],"yyyymm")


or

select AccountID,Count(Format([StatementDate],"yyyymm")) As Expr1,Count(Format([StatementDate],"yyyymm")) As expr2
from tableName
Group by AccountID, Format([StatementDate],"yyyymm")
having Count(Format([StatementDate],"yyyymm"))>1
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 

Author Comment

by:NNiicckk
ID: 39918850
The first one had "Cannot have aggregate function in WHERE clause (Count(Format([StatementDate],"yyyymm"))>1

The second one worked, thanks.

The results give me the # of statements in expr1 and expr2:

AccountID      Expr1      Expr2
125555                  3               3
567891               2          2


Is there a way to show the Month duplicated or should I just hide 1 of the fields?
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 39918875
try


select AccountID,Count(Format([StatementDate],"yyyymm")) As Expr1,Format([StatementDate],"yyyymm") As expr2
from tableName
Group by AccountID, Format([StatementDate],"yyyymm")
having Count(Format([StatementDate],"yyyymm"))>1
0
 

Author Comment

by:NNiicckk
ID: 39919087
That works, thanks again
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question