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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filtering Multiple Entries

Status
Not open for further replies.

cpc34

Technical User
Aug 16, 2005
22
GB
Is there a command that will allow me to bring up a query that shows only one occurrence of a name? The form it is looking at has the same names occurring repeatedly. Also, is there a way of getting the same query to count the number of occurrences, so that it sas something like: Person A, 5; Person B, 2; Person C, 1 etc?
This is an attempted fix to get around a many-to-many problem I am having with a subform.
 
Hi

Not quite sure what you;re trying to end up with but here goes...


On your form you could look at adding a 2 column combo box with an sql clause like

select distinct(Name),Count(*) from Table order by Name

this should give you each unique Name and number of times it is found in the table.

Then in the AfterUpdate event on the combo box add the lines

Me.Form.FilterOn = False
Me.Form.Filter = "[Name]='" & Combo1 & "'"
Me.Form.FilterOn = True
Me.Form.Requery

this should change the form so that after you choose a unique name you can now scroll through each entry with that unique name.

Sure you could take this principle and apply it to the sub form..

Regards

BuilderSpec
 
Use an aggregate query:
SELECT Person, Count(*) As CountOfDup FROM yourTable GROUP BY Person;

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top