Refreshing from a sub-form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

My main form has six sub forms which are refreshed when I select an item from
a list box.
I have used the On Click, Event Procedure which works fine;
[Forms]![frmModules]![frmPersonnelDetails].Requery
[Forms]![frmModules]![frmModule1].Requery
[Forms]![frmModules]![frmModule2].Requery
[Forms]![frmModules]![frmModule3].Requery
[Forms]![frmModules]![frmExclusiveControl].Requery
[Forms]![frmModules]![frmLockboxOfficer].Requery
I have also used Me.Refresh and this work fine as well.
However I also need to do the same function in the After Update in some of
the sub-forms to refresh all but it doesn’t work from the sub-form. I have
tried both the requery and the Refresh but no luck.

Can any one point me in the right direction. Also what is the difference
between doing the refresh and requery.

Regards
Nick
 
Hi Nick,

Usually when you are calling requery on a subform, you should use
forms!MAINFORMNAME.SUBFORMNAME.form.requery

That might fix you up when calling it from a subform. If not, you could try

me.parent.SUBFORMNAME.form.requery

Where SUBFORMNAME is the actual name of the subform control on your main
form, not the subforms name in the database if you know what I mean.

Hope this helps.

Damian.
 
Hi Damian,
Thanks for your reply. This has fixed my problem in that everything
requeries but the curser moves to the first field in the form. This is
annoying, as two fields need to be able to do the requery.
Is there any way of preventing this

Nick


Damian S said:
Hi Nick,

Usually when you are calling requery on a subform, you should use
forms!MAINFORMNAME.SUBFORMNAME.form.requery

That might fix you up when calling it from a subform. If not, you could try

me.parent.SUBFORMNAME.form.requery

Where SUBFORMNAME is the actual name of the subform control on your main
form, not the subforms name in the database if you know what I mean.

Hope this helps.

Damian.

Nick hfrupn said:
My main form has six sub forms which are refreshed when I select an item from
a list box.
I have used the On Click, Event Procedure which works fine;
[Forms]![frmModules]![frmPersonnelDetails].Requery
[Forms]![frmModules]![frmModule1].Requery
[Forms]![frmModules]![frmModule2].Requery
[Forms]![frmModules]![frmModule3].Requery
[Forms]![frmModules]![frmExclusiveControl].Requery
[Forms]![frmModules]![frmLockboxOfficer].Requery
I have also used Me.Refresh and this work fine as well.
However I also need to do the same function in the After Update in some of
the sub-forms to refresh all but it doesn’t work from the sub-form. I have
tried both the requery and the Refresh but no luck.

Can any one point me in the right direction. Also what is the difference
between doing the refresh and requery.

Regards
Nick
 
Hi again Nick,

A couple of things - check your tab order to make sure that when you press
tab it goes to the next field on your form. If it's the last field that you
need this functionality on, check that you have your form options set to
"cycle current record" or "cycle current page".

Lastly, you could always force it to go where you want it to by calling a
setfocus event, eg: me.FIELDYOUWANT.setfocus (after the requery calls).

Hope this helps.

Damian.

Nick hfrupn said:
Hi Damian,
Thanks for your reply. This has fixed my problem in that everything
requeries but the curser moves to the first field in the form. This is
annoying, as two fields need to be able to do the requery.
Is there any way of preventing this

Nick


Damian S said:
Hi Nick,

Usually when you are calling requery on a subform, you should use
forms!MAINFORMNAME.SUBFORMNAME.form.requery

That might fix you up when calling it from a subform. If not, you could try

me.parent.SUBFORMNAME.form.requery

Where SUBFORMNAME is the actual name of the subform control on your main
form, not the subforms name in the database if you know what I mean.

Hope this helps.

Damian.

Nick hfrupn said:
My main form has six sub forms which are refreshed when I select an item from
a list box.
I have used the On Click, Event Procedure which works fine;
[Forms]![frmModules]![frmPersonnelDetails].Requery
[Forms]![frmModules]![frmModule1].Requery
[Forms]![frmModules]![frmModule2].Requery
[Forms]![frmModules]![frmModule3].Requery
[Forms]![frmModules]![frmExclusiveControl].Requery
[Forms]![frmModules]![frmLockboxOfficer].Requery
I have also used Me.Refresh and this work fine as well.
However I also need to do the same function in the After Update in some of
the sub-forms to refresh all but it doesn’t work from the sub-form. I have
tried both the requery and the Refresh but no luck.

Can any one point me in the right direction. Also what is the difference
between doing the refresh and requery.

Regards
Nick
 
Back
Top