Totals not working

  • Thread starter Thread starter iamnu
  • Start date Start date
I

iamnu

In tblRecipes I have a Field as follows:
TotalCount: Nz(DCount("*","tblRecipeCategories","RecipeID = " &
[RecipeID]))

This works fined until I "Filter" the records with the Procedure
below, when TotalCount gives me "#Error".
How do I make TotalCount work with the following Procedure?
Thanks, Bernie

Private Sub cboShowCategory_AfterUpdate()
Dim strSQL As String
strSQL = "SELECT DISTINCTROW tblRecipes.* FROM tblRecipes " & _
"INNER JOIN tblRecipeCategories ON " & _
"tblRecipes.RecipeID = tblRecipeCategories.RecipeID " & _
"WHERE tblRecipeCategories.CategoryID = " & Me.cboShowCategory
& ";" 'this code works if the value is a number (like CategoryID)
Me.RecordSource = strSQL
End Sub
 
Iamnu -

The Nz function is missing all of the parameters. Try this:

TotalCount: Nz(DCount("*","tblRecipeCategories","RecipeID = " &
[RecipeID]),0)
 
Back
Top