Counting Combo box Value

Numpty

on t'internet
Local time
Today, 06:36
Joined
Apr 11, 2003
Messages
60
I have a control within a sub form which will count the number of specific values chosen from a combo box.

e.g if a particular value has been chosen 6 times it will display the number 6 as a running total.
It is counting the number of specific entries within the underlying table. What I would like to do is have it count and display the entries but only when they match with the Id number of the main form.
I've searched the forum but can't seem to find an answer.



:confused:
 
You'll need something like this as the ControlSource property for the text box showing the running total:

=Nz(DCount("MyField", "MyTable", "IDNumber = " & Forms!Main!txtIDNumber & " And MyField = '" & Me!cboMyField & "'"), 0)


This example assumes that IDNumber is numeric, and that both MyField and the bound column of cboMyField areText; in other cases you'll need to add or delete delimiting apostrophes as appropriate.
 

Users who are viewing this thread

Back
Top Bottom