Fixed SQL error in searchEvent when no table was selected.