Actually I think that whole block should be If keycnt > -1 or intSearchMember <> 0 Then
'## Forum_SQL - Find all records with the search criteria in them
strSql = "SELECT DISTINCT C.CAT_STATUS, C.CAT_SUBSCRIPTION, C.CAT_NAME, C.CAT_ORDER"
strSql = strSql & ", F.F_ORDER, F.FORUM_ID, F.F_SUBJECT, F.CAT_ID"
strSql = strSql & ", F.F_SUBSCRIPTION, F.F_STATUS"
strSql = strSql & ", T.TOPIC_ID, T.T_AUTHOR, T.T_SUBJECT, T.T_DATE, T.T_STATUS, T.T_LAST_POST"
strSql = strSql & ", T.T_LAST_POST_AUTHOR, T.T_LAST_POST_REPLY_ID, T.T_REPLIES, T.T_UREPLIES, T.T_VIEW_COUNT"
strSql = strSql & ", M.MEMBER_ID, M.M_NAME, M1.M_NAME AS LAST_POST_AUTHOR_NAME"
strSql = strSql & ", F.F_PRIVATEFORUMS, F.F_PASSWORD_NEW, T.T_STICKY"
strSql2 = " FROM ((((" & strTablePrefix & "FORUM F "
strSql2 = strSql2 & "INNER JOIN " & strActivePrefix & "TOPICS T ON F.FORUM_ID = T.FORUM_ID) "
strSql2 = strSql2 & "LEFT JOIN " & strActivePrefix & "REPLY R ON T.TOPIC_ID = R.TOPIC_ID) "
strSql2 = strSql2 & "INNER JOIN " & strMemberTablePrefix & "MEMBERS M ON T.T_AUTHOR = M.MEMBER_ID) "
strSql2 = strSql2 & "INNER JOIN " & strTablePrefix & "CATEGORY C ON T.CAT_ID = C.CAT_ID) "
strSql2 = strSql2 & "LEFT JOIN " & strMemberTablePrefix & "MEMBERS M1 ON T.T_LAST_POST_AUTHOR = M1.MEMBER_ID "
strSql2 = strSql2 & "LEFT JOIN (SELECT TOPIC_ID, R_AUTHOR FROM "& strActivePrefix & "REPLY GROUP BY TOPIC_ID, R_AUTHOR "
if MemberID > 0 then strSql2 = strSql2 & "HAVING (R_AUTHOR = " & MemberID & ")"
strSql2 = strSql2 & ") AS RD ON T.TOPIC_ID = RD.TOPIC_ID "
strSql2 = strSql2 & "WHERE T.TOPIC_ID IN ("
<