Subforms autoupdate

ppataki

Registered User.
Local time
Yesterday, 23:12
Joined
Sep 5, 2008
Messages
267
Dear All,

I have a form that has a number of subforms on it.
All of the subforms have the same datasource (a table)

My problem is that if I insert a new record in one of the subforms, then insert a new record into another one, 2 new records will be added

Could you please advise on how I could get the subforms updated after inserting a record to one of them? (so after inserting a new record in one of them, that new record would be displayed immediately in all the others as well)

Many thanks in advance ;)
 
Here's your mistake:

"All of the subforms have the same datasource (a table)"

Why have all the subforms instead of a bunch of textboxes?
 
The data source of the main form (simple form) is a table containing master data while the data source of the subforms is a table containing annual data that needs to be appended continuously, so it is displayed as subforms
The two tables are linked by child and parent fields
So the problem is that whenever I add a new record in one of the subforms, the other subforms should somehow get refreshed

Thank you
 
You can try requerying them, but I'm still not clear on why you have multiple subforms. A form/subform is fine and normal, but having multiple subforms bound to the same table is not. It implies either a table design problem or a form design problem. Why do you have more than one?
 
How can I requery them?
I have more because the main form is tiled to segments and each segment needs to have different fields displayed from the annual data table (which is displayed through subforms)
So basically I could display all fields in one subform, but because there are different parts, I need to display different fields accordingly

Many thanks
 
I still worry about a design problem, but try this in the after update event of a subform

Forms!MainFormName.OtherSubformControlName.Requery
 
It works perfectly!!
Thank you very much!
 

Users who are viewing this thread

Back
Top Bottom