2 Subforms but only 1 OnCurrent Event fires

  • Thread starter Thread starter Kofi
  • Start date Start date
K

Kofi

I have a form with 2 subforms on it. Both use the same data set and
are linked to the main form by customerid fields. One form is a
datasheet the other is a single form I use to display the current
record in the datasheets values.

I synchronise these forms using code in the oncurrent event of the
datasheet but I also wish to control the display of controls on the
single form using the oncurrent event. So that only pertinent
controls are enabled based on the data in the underlying recordset.

This works fine when the main form is initially loaded but if I move
onto a different recordset only one of the oncurrent events fires
depending on which subform is the latest subform.

Any ideas if this is a bug that gets fixed in a later version or has
anyone got a workaround.

Cheers

Kofi
 
This works fine when the main form is initially loaded but if I move
onto a different recordset only one of the oncurrent events fires
depending on which subform is the latest subform.

Any ideas if this is a bug that gets fixed in a later version or has
anyone got a workaround.

I wouldn't call it a bug: I would not expect the Current event to fire
unless a record in the subform is selected as the current record.

You could explicitly call each subform's Current event in the
mainform's Current event, or setfocus to a control in the subform to
force a call to Current.
 
John Vinson said:
I wouldn't call it a bug: I would not expect the Current event to fire
unless a record in the subform is selected as the current record.

You could explicitly call each subform's Current event in the
mainform's Current event, or setfocus to a control in the subform to
force a call to Current.

Thanks for the suggestion I've overcome this by calling each subforms
oncurrent event from the main forms onactivate event.

It would be really useful though if a subforms onactivate event was
fired whenever a main form's was fired.

Cheers for your help
 
Back
Top