Try temporarily removing or disabling Set Error capture and test.
What error message do you get?
No Records Found?
No search criteria specified?
Or do you still get no error message at all?
No message at all.
Seems to work once I've tried it several times from the same machine but if any changes are made to the script then it quits working. Sometimes it works sometimes it doesn't
No message at all means either:
The script never ran or
It ran and found records, but then whatever came next changed your found set.
It could also be that your script is damaged.