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!

Conditional Counting Logic & IIF vs IF 1

Status
Not open for further replies.

3734kumo

Programmer
Mar 18, 2002
12
0
0
US
Hope for any help on the following:

If I wanted a count of records based upon a value in an other field, would the statement in the text box look like:

=if xfield = 1 then count(*)

Also, I see both IF and IIF used: what is the difference?

Thanks for any help
 
If is used in VB code:

If A=B then
'some code
Else
'some different code
end if

IIF is the immediate if used in functions:

IIF(A=B,True expression, False expression)

In order to achieve your specific results, you'll need to have a sum in either a report or group footer. The text box should have the following control source (or something like it):

=Sum(iif([xfield]=value,1,0)
 
Many thanks to VogonPoet. Someties a very simple answer and example is all that is needed. My grey matter at 70 needs a little stimulous, eventho I have been in the computer field since 1951.

Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top