Ok, I have a user that wants to calculate the results of an audit. The user brings up a form, and selects yes, no, or na on numerous questions. I ended up putting the following in a query:
NumberOfYes: (Count(IIf([Q3CPSharedWithSettingIn1Day]="Yes",0))+Count(IIf([Q3bCPSharedForPlnd]="Yes",0))+Count(IIf([Q4PCPNotificationIn2Days]="Yes",0))+Count(IIf([Q5ContactIn5Days]="Yes",0))+Count(IIf([Q6ConsistentPersonIn5Days]="Yes",0))+Count(IIf([Q7ChgsCommunicatedIn2Days]="Yes",0))+Count(IIf([Q8MedReview]="Yes",0)))
I also have the same code but for number of Nos.
NumberOfNo: (Count(IIf([Q3CPSharedWithSettingIn1Day]="No",0))+Count(IIf([Q3bCPSharedForPlnd]="No",0))+Count(IIf([Q4PCPNotificationIn2Days]="No",0))+Count(IIf([Q5ContactIn5Days]="No",0))+Count(IIf([Q6ConsistentPersonIn5Days]="No",0))+Count(IIf([Q7ChgsCommunicatedIn2Days]="No",0))+Count(IIf([Q8MedReview]="No",0)))
Basically, the query looks at each field and counts if its a yes or no, then I add the NumberOfYes and the NumberOfNo then divide NumberOfYes to get the score. My question is, I'm sure there has to be a more elegant way of doing this, plus, if a new question is ever added, the code would have to be updated. Is there a better way to search all the questions and count the yeses and no's?
John F
Reply via web post | Reply to sender | Reply to group | Start a New Topic | Messages in this topic (1) |
Tidak ada komentar:
Posting Komentar