Refresh problem with SubForms

fernando_lm
fernando_lm Member Posts: 27
I hope you'll understand my request, my knowledge of english language is quite basic.

I've got a main form (with no SourceTable) and two SubForms (Meeting To-dos and not-Meeting To-dos).
The Subforms records are filtered using a function on the main form:

fntActualizar()

CLEAR(rstTarea);
rstTarea.SETCURRENTKEY(Date,”Starting time”);
rstTarea.SETFILTER(“Salesperson Code”,txtFiltroVendedores);
rstTarea.SETFILTER(Date,’=>%1&=<%2’,datFechaDesde,datFechaHasta);
rstTarea.SETFILTER(“System To-do Type”,’=%1|=%2’, rstTarea. “System To-do Type”::Organizer);
CurrForm.SubTareas.FORM.SETTABLEVIEW(rstTarea);
CurrForm.SubTareas.ACTIVATE:
CurrForm.SubTareas.UPDATECONTROLS:
CurrForm.UPDATE;

I've got two problems:
1) When I first open the mainform (OnOpenForm trigger) i run the function, but the filters do not apply formely. After that whenever i run the function it works fine and the subforms show the right records.

2) Even when the records update properly, I want the subforms to show the first record when ever they're filter is updated. (I've tryed this with WshShell: it works fine if i run it from a button on the subform but not if i call it from the main form)

Comments

  • bbrown
    bbrown Member Posts: 3,268
    Create a function on the subform

    Function UpdateForm
    CurrForm.UPDATE;

    Then call it from main form

    CurrForm.SUbFormName.Form.UpdateForm
    There are no bugs - only undocumented features.
  • kriki
    kriki Member, Moderator Posts: 9,121
    I hope you'll understand my request, my knowledge of english language is quite basic.
    Not bad for "quite basic"! =D>
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • fernando_lm
    fernando_lm Member Posts: 27
    The UpdateForm function really helped me. Now the subforms records update formerly when I open the mainform.

    Yet the second point is not still working as I’d like to: When I update Meetings and Tasks Subforms, I want to show the first record on each table. To do that I execute:

    CurrForm.Subform.ACTIVATE;
    CurrForm.Subform.fntTakeFirst;

    fntTakeFirst()
    CREATE(WshShell);
    WshShell.SendKeys('^{HOME}');
    CLEAR(WshShell);

    The point is, if I run this for both subforms, it only works for the last one I activate (and only if I do not activate any other object after that).
  • sabzam
    sabzam Member Posts: 1,149
    Hi,

    I had the same problem with the subforms but still did not solve it. The CURRFORM....... code should be placed in the open form or in the activate form?