The object reference 'gform' is out of scope.
A quick fix would be to declare the reference to be PUBLIC before DO FORM...
A longer term strategy would be to create a simple forms manager using CreateObject() in the root of your main.prg and using ADDPROPERTY(), add the object references to the forms manager.
DO FORM myForm NAME oFormsManager.oMyForm
would be the syntax.
In the .Destroy() or other suitable event of each form, you can remove the object reference with REMOVEPROPERTY() to avoid dangling a object reference.