Subject Re: form.close() not working
From Mervyn Bick <invalid@invalid.invalid>
Date Thu, 13 May 2021 07:56:32 +0200
Newsgroups dbase.getting-started

On 2021/05/13 06:18, AGOSTINHO wrote:
> Dear group.
> I'm having two issues with this form:
>
> 1. form.close() does not closes this form
> 2. I'm getting an error when run this form saying Error:  Variable undefined:  AG

The form doesn't close because you have used the pushbutton's onClose
event handler instead of it's onClick event handler.  When you click on
the button nothing happens because there isn't an event handler assigned
to the onClick event.

The variable AG is created in the form's onOpen event handler.  It is
only in scope for the form's onOpen event handler or from a function
executed by the onOpen event handler.  For other functions or event
handlers on the form AG is out of scope and is, therefore, invisible.

If you save the name to a user-defined property of the form you will be
able to access the name from anywhere on the form.


    form.ag=form.users1.rowset.fields["NAAM"].VALUE

    function PUSHBUTTON2_onClick()
       IF form.ag="AGOSTINHO"
          *say someting
       ENDIF
       return

Mervyn.