A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

"Find Duplicates" Query



 
 
Thread Tools Display Modes
  #1  
Old August 6th, 2006, 09:42 PM posted to microsoft.public.access.queries
FJquestioner
external usenet poster
 
Posts: 30
Default "Find Duplicates" Query

I have a query to find duplicate invoice numbers. I use the access find
duplicate wizard query as follows:

SELECT Invoices.AssignorInvoiceNumber
FROM Invoices
WHERE (((Invoices.AssignorInvoiceNumber) In (SELECT [AssignorInvoiceNumber]
FROM [Invoices] As Tmp GROUP BY [AssignorInvoiceNumber] HAVING Count(*)1)))
ORDER BY Invoices.AssignorInvoiceNumber;

It works fine however I have a related macro wherein a form is closed only
if there are no duplicates found in the above query. I set the form to close
if the AssignorInvoiceNumber in the query is Null. However, when there are
no duplicates the query returns blank cells that seem to be neither Null nor
blank fields like " " so the condition in my macro won't work.

In essence, what condition do I write in a macro such that the macro action
occurs when the query above reveals no duplicates?

I'm stumped.

Thanks very much in advance.
  #2  
Old August 7th, 2006, 10:57 AM posted to microsoft.public.access.queries
Gary Walter
external usenet poster
 
Posts: 50
Default "Find Duplicates" Query


"FJquestioner"wrote:
I have a query to find duplicate invoice numbers. I use the access find
duplicate wizard query as follows:

SELECT Invoices.AssignorInvoiceNumber
FROM Invoices
WHERE (((Invoices.AssignorInvoiceNumber) In (SELECT

[AssignorInvoiceNumber]
FROM [Invoices] As Tmp GROUP BY [AssignorInvoiceNumber] HAVING

Count(*)1)))
ORDER BY Invoices.AssignorInvoiceNumber;

It works fine however I have a related macro wherein a form is closed only
if there are no duplicates found in the above query. I set the form to

close
if the AssignorInvoiceNumber in the query is Null. However, when there

are
no duplicates the query returns blank cells that seem to be neither Null

nor
blank fields like " " so the condition in my macro won't work.

In essence, what condition do I write in a macro such that the macro

action
occurs when the query above reveals no duplicates?

I don't use macros, but the test I'd probably use
would involve the domain function DCount
(assuming query above were named "qryDup")

If DCount("*","qryDup") = 0 Then
'close form
Else
'do something else (or nothing)
End If


  #3  
Old August 20th, 2006, 03:04 AM posted to microsoft.public.access.queries
FJquestioner
external usenet poster
 
Posts: 30
Default "Find Duplicates" Query

Thanks Gary. It worked perfectly.

"Gary Walter" wrote:


"FJquestioner"wrote:
I have a query to find duplicate invoice numbers. I use the access find
duplicate wizard query as follows:

SELECT Invoices.AssignorInvoiceNumber
FROM Invoices
WHERE (((Invoices.AssignorInvoiceNumber) In (SELECT

[AssignorInvoiceNumber]
FROM [Invoices] As Tmp GROUP BY [AssignorInvoiceNumber] HAVING

Count(*)1)))
ORDER BY Invoices.AssignorInvoiceNumber;

It works fine however I have a related macro wherein a form is closed only
if there are no duplicates found in the above query. I set the form to

close
if the AssignorInvoiceNumber in the query is Null. However, when there

are
no duplicates the query returns blank cells that seem to be neither Null

nor
blank fields like " " so the condition in my macro won't work.

In essence, what condition do I write in a macro such that the macro

action
occurs when the query above reveals no duplicates?

I don't use macros, but the test I'd probably use
would involve the domain function DCount
(assuming query above were named "qryDup")

If DCount("*","qryDup") = 0 Then
'close form
Else
'do something else (or nothing)
End If



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 02:23 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.