Connecting Tech Pros Worldwide Forums | Help | Site Map

Refreshing a form - automatically

Newbie
 
Join Date: Sep 2006
Posts: 6
#1: Sep 4 '06
How do I get a form to automatically refresh once (not continually using a timer).

The scenario I have uses a parent table and a child table.
(thanks to mmcarthy for indicating better termenology than I was using)
I have a main form that displays one page per parent record and all the related child records in a sub-form.
I then have a second form from which I can select records to be added (appended) to the child records. When the second form closes a query appends selected records to the child table. The problem I cannot solve is to get the main form, in particular to sub-form section, to update (refresh) automatically after I close the second form.

thanks
Iain

msquared's Avatar
Administrator
 
Join Date: Aug 2006
Location: Dublin, Ireland
Posts: 10,886
#2: Sep 5 '06

re: Refreshing a form - automatically


In the On Close (Button click or whatever) event on the second form put the following code. Be careful of the subform name, check the name under the Properties in the Other tab.

[CODE ]

Forms("NameOf ParentForm")![SubformName].Requery

[/code]

Quote:

Originally Posted by Iain

How do I get a form to automatically refresh once (not continually using a timer).

The scenario I have uses a parent table and a child table.
(thanks to mmcarthy for indicating better termenology than I was using)
I have a main form that displays one page per parent record and all the related child records in a sub-form.
I then have a second form from which I can select records to be added (appended) to the child records. When the second form closes a query appends selected records to the child table. The problem I cannot solve is to get the main form, in particular to sub-form section, to update (refresh) automatically after I close the second form.

thanks
Iain

msquared's Avatar
Administrator
 
Join Date: Aug 2006
Location: Dublin, Ireland
Posts: 10,886
#3: Sep 5 '06

re: Refreshing a form - automatically


Sorry the CODE indicators shouldn't be showing

In the On Close (Button click or whatever) event on the second form put the following code. Be careful of the subform name, check the name under the Properties in the Other tab.


Expand|Select|Wrap|Line Numbers
  1.  
  2. Forms("NameOf ParentForm")![SubformName].Requery
  3.  
  4.  
Newbie
 
Join Date: Sep 2006
Posts: 6
#4: Sep 5 '06

re: Refreshing a form - automatically


Thank you very much.

I had got close to the solution but had not realised that I must direct the requery command.

Iain
Reply