The opensecret documentation says (emphasis added):
The opensecret statement opens a database without opening any windows or launching the .Initialize procedure.
Since no windows are opened, whatever window and database that was active before the opensecret is still active, You can’t use any fields in the just opened secret databases. If you want to do so, add a setactivedatabase statement, like this: