count duplicates in combobox (1 Viewer)

bodylojohn

Registered User.
Local time
, 22:16
Joined
Dec 28, 2005
Messages
205
Hello everybody,

I have a form in an Access 2010 application containing a combobox.
The combobox may contain duplicates (that's OK).

However I would like to know how many (if any) duplicates consist for a certain value.

So lets say I enter the value "TEST" in my combobox.
Then I'd like a msgbox to popup and tell me how many records there are with the value "TEST"

Thanks in advance....
 

bob fitz

AWF VIP
Local time
Today, 04:16
Joined
May 23, 2011
Messages
4,728
Perhaps in the AfterUpdate event you could use the DCount() function on the domain used as the Row Source property, with the selection made as the criteria to return the required value
 

Ranman256

Well-known member
Local time
, 23:16
Joined
Apr 9, 2015
Messages
4,337
Create a query, that uses the query in the combo,
This will count the items in the combo. (Turn on counting)
Then when the user picks the item, look it up....

Q1:combo qry
Q2: select name,count(name) as Cnt from Q1

Code:
Sub cboBox_afterUpdate()
   MsgBox dlookup("[Cnt]","Q2","[name]='" & me.cboBox & "'"
End sub
 

Users who are viewing this thread

Top Bottom