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

Dcount Problem!

Status
Not open for further replies.

baggyboy26

Technical User
Jun 12, 2008
19
GB
Hi I'm trying to count some values from a table to display in a textbox. This is the vba code i am using.

Me.Ctl4bP2.ControlSource = "=DCount(""[2007]![MathsSum1]"", ""[2007]"", ""[2007]![MathsSum1]='4b' AND [2008]![Year]='Year 6'"")"

It returns a value of 8 but when i count them myself there is only 5! I don't understand what i'm missing.

Thanks
 
try
"=DCount("MathsSum1", "2007", "MathsSum1='4b' AND Year='year 6')
 
sorry
"=DCount(""MathsSum1"", ""2007"", ""MathsSum1='4b' AND Year='year 6'"")"
 
Thanks pwise

I have tried your suggestion and it now returns the value of 3. As i said earlier the value should be 8, is it a coincidence that the number i want in the difference of the numbers returned?
Thanks for replying :)
 
Sorry!!! I'm a muppet! I counted the values wrongly, the original answer of 8 was incorrect but the new value of 3 is correct. Your code was still better than mine, many thanks!
oops!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top