Your SQL statement was incorrect:
I have rewritten it assuming all the field referenced are in a single table:
The variable intRowReqd will be your selected 10, 25 or 50.Code:sSQL = "SELECT TOP " & intRowReqd & " DocumentName, HitCount " & _ "FROM RollupDocument " & _ "WHERE RollupType = " & iRollupType & " " & _ "AND RollupYear = " & iRollupYear & " " & _ "AND RollupValue = " & iRollupValue & " " & _ "ORDER BY Hitcount Desc"
Your statement had two tables 'RollupDocument' and 'RollupLookupDocument' specified withot a JOIN. If the selected fields are from both then you should explicitly use the table.field in the SELECT and WHERE clause, using table1.joinfield = table2.joinfield' to JOIN them.
![]()




Reply With Quote