Totals not working

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
 
D

Daryl S

Iamnu -

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

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top