If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Totals not working
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 |
#2
|
|||
|
|||
Totals not working
Iamnu -
The Nz function is missing all of the parameters. Try this: TotalCount: Nz(DCount("*","tblRecipeCategories","RecipeID = " & [RecipeID]),0) -- Daryl S "iamnu" wrote: 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 . |
Thread Tools | |
Display Modes | |
|
|