Selasa, 18 November 2014

Re: [MS_AccessPros] Dcount Function

 

Thanks John it worked .

it was a perfect job.  I have your book Microsoft Access 2003 Inside Out. You are indeed a MVP !

God bless.

Ade.


From: "John Viescas JohnV@msn.com [MS_Access_Professionals]" <MS_Access_Professionals@yahoogroups.com>
To: MS_Access_Professionals@yahoogroups.com
Sent: Tuesday, 18 November 2014, 20:53
Subject: Re: [MS_AccessPros] Dcount Function

 
Ade-

You are counting all the occurrences of the value 4 in column Median5 in any row in the first DCount.  The second DCount gives you how many rows have the value 4 in the Median4 field.

To count by record, you need something like:

Count4: IIf([Median1] = 4, 1, 0) + IIf([Median2] = 4, 1, 0) + IIf([Median3] = 4, 1, 0) + IIf([Median4] = 4, 1, 0) + IIf([Median5] = 4, 1, 0) + IIf([Median§] = 4, 1, 0)

John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
SQL Queries for Mere Mortals 
(Paris, France)






On Nov 17, 2014, at 11:45 PM, Adeboyejo Oyenuga aoye_99@yahoo.co.uk [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:

I need help with my query. I will simplify the table called 'Test' its based on as follows. Med1 through Med6 being fields.


Record No     Med1   Med2  Med3   Med4  Med5   Med6
001                      2          2          4          3           3          5
002                      3          3          3          4           4          4     

When I tried to create a calculated control to return the count of 4 in each row, I got 3 for record 1 and 3 for record 2 . The correct answer is 1 for record 1 and 3 for record 2.

The expression I used is shown below. Please assist as I do not know what I am doing wrong.

Expr1: DCount("[Median5]","Test","[Median5] = '4'")+DCount("[Median4]","Test","[Median4]='4'")+DCount("[Median6]","Test","[Median6]='4'")
 

Thanks

Ade



__._,_.___

Posted by: Adeboyejo Oyenuga <aoye_99@yahoo.co.uk>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (3)

.

__,_._,___

Tidak ada komentar:

Posting Komentar