Actually, it seems you're only checking the first record ... (or more to the point, the record you happen to be on after the Sort).
You could write a loop, but a Find seems more straightforward:
Enter Find Mode
Set Field [ Master File::customPrice ; "=" ]
Set Error Capture [ on ]
Constrain Found Set
If [ Get ( FoundCount ) ]
Show Custom Dialog [ "Missing prices ..." etc. ]
here's what pops out to me: first, your Get(LastError) <> 0 seems to be checking if Show/Hide Toolbars worked. Secondly, after sorting (presumably by Custom Price), you need to Go to Record, First.
I agree with erolst, but since you are performing a find to get the records you want for the PDF, you need to do this in a way that does not lose that found set.
So take the suggested script and add a "New window" script step at the beginning of it and then add a close window step at the end and just before any exit script step. That way, your script uses the other window to do the check and leaves the found set in your current window unmodified.
Thanks for these suggestions. I'll dive in a little later today to see what I come up with.
just to explain a bit better ... when you look at your set of records, the first record might have a price of 75. Once you sort by price, the record showing will be the same - with a price of 75. Once you go to what is now the first record in the sorted set, you'll encounter an empty price, if any exist in your found set.