Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I check a query field dynamically?

Status
Not open for further replies.

BrazilTechie

Programmer
Nov 13, 2002
88
0
0
BR
I am trying to find duplicates in a table and if found I want a report to be printed. (It should only be even viewed if there are duplicates).

What have I done so far?

I have created a query using the wizard, but I have not been able to check the count (if any dups) inside of my code.

I would prefer to do all inside of a code.

Any help will be appreciated.

Thanks in advance.

BrazilTechie
 
You get duplicates where you are counting something grouped by something else. Duplicates are where the count is greater than 1. So the first thing is to experiment with your SQL (using HAVING and maybe sub-queries) until you get the list of records involved in duplication. After that it is easy to switch report/no-report depending on whether you get zero or more records pasing the test.

 
BrazilTechie

Much will depend on what type of duplicates you are hunting for. You may be fortunate and track them down with SQL queries and subqueries.

Another approach may be to consider using VBA code to "walk" through your table(s). Queries would be considerably faster, VBA coding would give you more control.

Richard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top