Answer
Check whether the fields you're comparing against (e.g. in the WHERE clause) are Persistent Custom Fields of type Reference — if so, the underlying table (_CFT/_CLT) actually stores the referenced record's ROWKEY (a GUID), not the human-readable key value you're used to seeing. The corresponding view (_CFV/_CLV) resolves that ROWKEY into the friendly value you see on screen, exposing it as two separate columns: a plain column (e.g. CF$_SUPPLIER) with the friendly value, and a _DB-suffixed column (e.g. CF$_SUPPLIER_DB) with the raw ROWKEY. If your custom page's query runs against the table (or against bind parameters that ultimately come from the table), comparing to the friendly value in your WHERE clause will never match, since the table itself only holds the ROWKEY — compare against the _DB column instead (or select from the _CFV/_CLV view if you need the friendly value directly).