views:

178

answers:

1

What I need is: what trigger to use and where to put it.

I will give you an example of what I am doing.

I have a Contract form that is fully editable except the contract financial areas, which is read only. I want the user to press a button called, “change rates” and that will have a trigger “When-Button-Pressed” and call_form(UpdateFinancials);.

Now, in this screen, I have the user change the financial information such as increase the contract from 50k to 100k. Then the user saves and exits. This will then close the child form "UpdateFinancials" and show the parent form "ContractForm". The problem is, it still has all the old information on it. I need the information in the form to refresh when it gets back from the child form of the Call_Form function.

A: 
  1. In the WHEN-BUTTON-PRESSED trigger, before you issue the CALL_FORM, set a variable (e.g. a hidden item or a global variable) to some value, e.g. 'CALLED_THE_FORM'.

  2. In the WHEN-WINDOW-ACTIVATED trigger, test the variable, if it's ='CALLED_THE_FORM', reset the variable (e.g. to NULL), and run whatever code you want to run when the user returns from the form (e.g. execute query or whatever).

Alternatively, just execute query from the WHEN-WINDOW-ACTIVATED trigger - if you want the refresh to happen every time the user returns to the form. But personally I prefer to only refresh when I believe it is absolutely required.

Jeffrey Kemp
Thanks Jeffrey. I had something like that, but what I ended up doing is just calling the "New_Form" instead of messing with the window activated. It now works the way the client wants it to work. Next time, I will use your suggestion.
DotNetDan