selecting from subform

Hello; I am creating a special Item lookup form with three tables on it. The two tables other than the main data item are shown as subforms. How can my main form detect and react to row selections on subforms? The data displayed in each subform is taken from the same table as the main data item. The subforms are just filtered a little differently for the user. Brian.

Hey Brian, If you create a subform for all three data items, you could write a function in the primary subform which you call from the secondary subforms. a

quote:


How can my main form detect and react to row selections on subforms?


CurrForm.SubFormName.FORM.GETRECORD(mySubFormRec);

Where SubFormName is the name of the SubForm whose selected record you want to access (so make sure you give a name to the subform!) and mySubFormRec is the same record as used in SubForm.SourceTable. ------- With best regards from Switzerland Marcus Fabian Edited by - fabian on 2001 May 29 00:57:01

quote:


Originally posted by fabian:

quote:


How can my main form detect and react to row selections on subforms?


CurrForm.SubFormName.FORM.GETRECORD(mySubFormRec);

Where SubFormName is the name of the SubForm whose selected record you want to access (so make sure you give a name to the subform!) and mySubFormRec is the same record as used in SubForm.SourceTable. ------- With best regards from Switzerland


fabian, is it possible to click on the subform record and update main form with some information? In my case, when sales person selects an item in the sales order subform I want to show 10 different discounts in the main form. Is it possible to do?

A Subform does not know it is a subform :). A Main form has its subfroms as variables (controls, rather). Calling main form’s function from within a subform does not work, because Navision will instantiate a new main form variable, and not link back to the one that’s on screen. Down and dirty solution may be calling subform’s function from onTimer trigger of a main form, to retrieve some data. This is the last resort type of solution, because it will hammer the database with requests. I would suggest revising the concept, however there is not enough details here to decide one way or another.