I have a peice of code that I want to use many times. It is a DCount function and I want to use a defined string to hold the table name in the DCount function. ie I will be performing the same DCount function on many tables.
This code returns the error "The Microsoft Jet database engine cannot find the input table 'tbl_Compliments_Log' " Now the table exists and is spelt correctly. If I cut and past the table name into the DCount function in stead of " & strMyTable & " it works ok.
Dim strMyTable As String
strMyTable = "tbl_Compliments_Log"
CompsYTD = DCount("*", " " & strMyTable & " ", "Year(Date_Raised) like " & myYear & "")
Thanks & Regard
Stephen
This code returns the error "The Microsoft Jet database engine cannot find the input table 'tbl_Compliments_Log' " Now the table exists and is spelt correctly. If I cut and past the table name into the DCount function in stead of " & strMyTable & " it works ok.
Dim strMyTable As String
strMyTable = "tbl_Compliments_Log"
CompsYTD = DCount("*", " " & strMyTable & " ", "Year(Date_Raised) like " & myYear & "")
Thanks & Regard
Stephen