Well, SET DELETED ON set's a default filtering "DELETED() = .F.", so counting deleted records while DELETED is set ON should always count 0. Browse behaves the same:
Select table && has some deleted records in it
SET DELETED ON
BROWSE FOR Deleted() &&results in an empty sheet
SET DELETED OFF
BROWSE FOR Deleted() &&shows the deleted records.
If you need a correct count on deleted records always SET DELETED OFF.
Concerning the problem with PACK in your earlier thread, I'd say you have a coupled problem with the DELETED setting and an index on deleted() that may be currupted.
You may try to get the correct PACK result with creating four tables with the COPY TO command I gave you:
a) set deleted on before copy to
b) set deleted off before copy to
c) a) plus drop the index on deleted() beforehand
d) b) plus drop the index on deleted() beforehand
I'd say you'll get the correct result with set deleted off and not dropping (but setting/activating!) the index beforehand, because as you say the index points to the right records. Nevertheless the index is defect if you get a different count when the index is dropped. So maybe the index is corrupt but as you always showed the data with this index set it represents the deleted records correctly, although the normal deletion mark says something different. After copiing the created table should have the right records, then drop the index on deleted() you copied (COPY TO ... WITH CDX) and rebuild it, afterwards index and real deleted records should be in sync.
Bye, Olaf.