A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Count - if statement....



 
 
Thread Tools Display Modes
  #1  
Old April 26th, 2008, 09:29 PM posted to microsoft.public.access.forms
[email protected]
external usenet poster
 
Posts: 96
Default Count - if statement....

Hi,

I created a box called TXT_Completed for me to put ="Completed: " &
Sum(IIf([Answer] like "1",1,0)) & " of " & Count (*)
and it works.

I have four groups and I want to set like below and I'm not able to
make it work.

="Completed: IIf([GroupA] like "1",1,0)) & " of " & Count (*)
and
next one,

="Completed: IIf([GroupB] like "1",1,0)) & " of " & Count (*)

I'm struggling last two A and B. Your help would be much
appreciated. I don't know if I do the right thing.

Thanks

Ads
  #2  
Old April 26th, 2008, 11:47 PM posted to microsoft.public.access.forms
Steve Schapel
external usenet poster
 
Posts: 1,422
Default Count - if statement....

Learning_codes,

The syntax of the one that works and the one that doesn't are different.

Also, the use of the "Like" keyword here is not necessary, apparently,
as you have no wildcard.

Therefore, try:
="Completed: " & Sum(IIf([GroupA]="1",1,0)) & " of " & Count (*)

If I have misunderstood, perhaps you can give some more details of where
these textboxes are located, and what is the meaning of the fields such
as Answer and GroupA and GroupB and what is the relationship between them.

--
Steve Schapel, Microsoft Access MVP

wrote:
Hi,

I created a box called TXT_Completed for me to put ="Completed: " &
Sum(IIf([Answer] like "1",1,0)) & " of " & Count (*)
and it works.

I have four groups and I want to set like below and I'm not able to
make it work.

="Completed: IIf([GroupA] like "1",1,0)) & " of " & Count (*)
and
next one,

="Completed: IIf([GroupB] like "1",1,0)) & " of " & Count (*)

I'm struggling last two A and B. Your help would be much
appreciated. I don't know if I do the right thing.

Thanks

  #3  
Old April 27th, 2008, 12:03 AM posted to microsoft.public.access.forms
[email protected]
external usenet poster
 
Posts: 96
Default Count - if statement....

On Apr 26, 6:47*pm, Steve Schapel wrote:
Learning_codes,

The syntax of the one that works and the one that doesn't are different.

Also, the use of the "Like" keyword here is not necessary, apparently,
as you have no wildcard.

Therefore, try:
="Completed: " & Sum(IIf([GroupA]="1",1,0)) & " of " & Count (*)

If I have misunderstood, perhaps you can give some more details of where
these textboxes are located, and what is the meaning of the fields such
as Answer and GroupA and GroupB and what is the relationship between them.

--
Steve Schapel, Microsoft Access MVP



wrote:
Hi,


I created a box called *TXT_Completed for me to put ="Completed: " &
Sum(IIf([Answer] like "1",1,0)) & " of " & Count (*)
*and it works.


I have four groups and I want to set like below and I'm not able to
make it work.


="Completed: IIf([GroupA] like "1",1,0)) & " of " & Count (*)
and
next one,


="Completed: IIf([GroupB] like "1",1,0)) & " of " & Count (*)


I'm struggling last two A and B. * Your help would be much
appreciated. *I don't know if I do the right thing.


Thanks- Hide quoted text -


- Show quoted text -


Thanks for getting back to me. My mistake.. it should be like this
but still not able to get the count.

="Completed: IIf([GroupA] like "Product A",Sum(IIf([Answer] like "1",
1,0)) & " of " & Count (*)
="Completed: IIf([GroupB] like "Product B",Sum(IIf([Answer] like "1",
1,0)) & " of " & Count (*)

  #4  
Old April 27th, 2008, 07:39 AM posted to microsoft.public.access.forms
Steve Schapel
external usenet poster
 
Posts: 1,422
Default Count - if statement....

Learning_codes,

As I said before, I am puzzled why you are using "Like", it doesn't make
sense.

Are you puttting this stuff into your posts here by copy/paste, or are
you re-typing? Copy/paste is best, so we can try to diagnise exactly
what you are working with.

These expressions have incorrect syntax. There is no closing ")" for
one of the IIf() functions, and also no "false part" argument for the
IIf(). Also, a string closure " was missing, and there is a space
between the Count and the "(".

As far as I can work out, I think you want this:
="Completed: " & IIf([GroupA]="Product A",Sum(IIf([Answer]="1",1,0)) & "
of " & Count(*),0)

--
Steve Schapel, Microsoft Access MVP

wrote:

Thanks for getting back to me. My mistake.. it should be like this
but still not able to get the count.

="Completed: IIf([GroupA] like "Product A",Sum(IIf([Answer] like "1",
1,0)) & " of " & Count (*)
="Completed: IIf([GroupB] like "Product B",Sum(IIf([Answer] like "1",
1,0)) & " of " & Count (*)

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 11:55 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
Copyright 2004-2018 OfficeFrustration.
The comments are property of their posters.