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

Dcount IIF revision 2

Status
Not open for further replies.

ciarra41

Technical User
Sep 11, 2006
116
US
Hi,

I currently use this to determine if I have more than one of the same value per rows.

CNT: IIf(IsNull([Custlogocnt]),"",IIf(DCount("Custlogocnt ","tbltickets","[ Custlogocnt] = '" & [Custlogocnt & "'")>1,"MANY",""))

But it’s only looking at text values. How could this be revise to look at number values or even both regardless if number or text.
 
Your values should be stored as either number or text, not both. If Custlogocnt is numeric, try:

CNT: IIf(IsNull([Custlogocnt]),"",IIf(DCount("Custlogocnt ","tbltickets","[Custlogocnt] = " & [Custlogocnt])>1,"MANY",""))

I'm not sure why you didn't copy and paste your working expression. There were at least 2 errors in your expression.


Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Thanks on the original response but could I revise this another way?

Now I need it to show how many times, exp...

IIf(IsNull([Custlogocnt]),"",IIf(DCount("Custlogocnt ","tbltickets","[Custlogocnt] = " & [Custlogocnt])>1,"MANY",""))

Instead on "Many" it will count the number of times I have the value.
 
You wanted simply this ?
IIf(IsNull([Custlogocnt]),0,DCount("*","tbltickets","Custlogocnt=" & [Custlogocnt]))

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Using the same example above from (PHV) example how I can do this with a text value. The example (PHV) provided only works for number values. I need to do the same thing for text values too.

Regards
C..
 
add string delimiters:
Code:
IIf(IsNull([Custlogocnt]),0,DCount("*","tbltickets",
"Custlogocnt=[COLOR=red]'[/color]" & [Custlogocnt] & "[COLOR=red]'[/color]"))



Leslie

Anything worth doing is a lot more difficult than it's worth - Unknown Induhvidual

Essential reading for database developers:
The Fundamentals of Relational Database Design
Understanding SQL Joins
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top