Reloading a subform

gibsonn

Registered User.
Local time
Today, 18:50
Joined
Jan 12, 2004
Messages
14
Hi all,

How do I reload a subform without leaving? Reason being is that I am deleting a record in the after insert event of the form and when I click on another tab/button whatever it comes up with deleted all the way accross. What would be ideal is that when the event is triggered is to re-load the form, which should get rid of the deleted columns and setfocus to an object within that subform.

Any ideas.....
 
Two ways (from the parent form):

  • requery the subform object;
    Code:
    Me.[i]subformObject.Requery[/i]
  • reassign the subform object's SourceObject;
    Code:
    Me.[i]subformObject[/i].SourceObject = "subformName"
 
Thanks for replying the requery method worked fine. Just one more thing how can I get the focus to remain on the object I have just changed once I have clicked on a tab/button etc outside of the subform?
 
You can't...the form and the subform are two different objects; there is only one focus so either an enabled control (or the form if there is no enabled control) on the form gets the focus or, likewise the subform object.

You can use the SetFocus method to set the focus to a specific control though.

i.e.

Code:
Me.[i]subformObject[/i].Control.SetFocus
 

Users who are viewing this thread

Back
Top Bottom