Subform Refresh

G

Guest

Hi

I have a subform based on a query, I click a button to open a further form,
allowing to edit the underlying records. When I close the "edit-form" I want
the subform to update. I can only do it by pressing F9. I have tried
me.refresh and me.requery on got focus, open, load. I am sure I am being dim
- I have searched the other questions but still no joy.

Thanks so much

Kerry
 
A

Allen Browne

You can programmatically requery the subform Sub1 with this line of code:
Me.[Sub1].Form.Requery

If it is on another form, use this kind of thing:
Forms.[Form1].[Sub1].Form.Requery
 
G

Guest

On what event do I put this code please?

Thank you

Kerry


Allen Browne said:
You can programmatically requery the subform Sub1 with this line of code:
Me.[Sub1].Form.Requery

If it is on another form, use this kind of thing:
Forms.[Form1].[Sub1].Form.Requery

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Kerry Purdy said:
I have a subform based on a query, I click a button to open a further
form,
allowing to edit the underlying records. When I close the "edit-form" I
want
the subform to update. I can only do it by pressing F9. I have tried
me.refresh and me.requery on got focus, open, load. I am sure I am being
dim
- I have searched the other questions but still no joy.

Thanks so much

Kerry
 
A

Allen Browne

When would you like it?

In the AfterUpdate event of the form that made the changes? (Be sure to use
the *form* event, not that of a control.)

In the Click event of a button?

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Kerry Purdy said:
On what event do I put this code please?

Thank you

Kerry


Allen Browne said:
You can programmatically requery the subform Sub1 with this line of code:
Me.[Sub1].Form.Requery

If it is on another form, use this kind of thing:
Forms.[Form1].[Sub1].Form.Requery

Kerry Purdy said:
I have a subform based on a query, I click a button to open a further
form,
allowing to edit the underlying records. When I close the "edit-form"
I
want
the subform to update. I can only do it by pressing F9. I have tried
me.refresh and me.requery on got focus, open, load. I am sure I am
being
dim
- I have searched the other questions but still no joy.
 
G

Guest

Sorry, this is still not working.

I have a Training Booking Main Form, with a sub form of a delegate list
(this list is based on a query showing the Name and Company Name of
delegates).

I click a button to either add a new company booking or select a delegate
from an existing company to edit the booking by deleting or adding a new
delegate for that company. This works perfectly.

However, when I close the form (New or Edit Booking) I would like the
Delegate list to update automatically - this is not happening.

On a few of the events (close, after update etc.) of the TB Bookings form I
have tried entering

Forms.[frm Training Booking (Main)].[tbl TB Del Data].Form.Requery

but this shows an error of run time error 438 - object does not support this
property or method.

I would appreciate some help please. Thank you very much for your time.

Kerry


Allen Browne said:
When would you like it?

In the AfterUpdate event of the form that made the changes? (Be sure to use
the *form* event, not that of a control.)

In the Click event of a button?

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Kerry Purdy said:
On what event do I put this code please?

Thank you

Kerry


Allen Browne said:
You can programmatically requery the subform Sub1 with this line of code:
Me.[Sub1].Form.Requery

If it is on another form, use this kind of thing:
Forms.[Form1].[Sub1].Form.Requery


I have a subform based on a query, I click a button to open a further
form,
allowing to edit the underlying records. When I close the "edit-form"
I
want
the subform to update. I can only do it by pressing F9. I have tried
me.refresh and me.requery on got focus, open, load. I am sure I am
being
dim
- I have searched the other questions but still no joy.
 
A

Allen Browne

Open the form [frm Training Booking (Main)] in design view.
Right-click the edge of the tab control, and choose Properties.
What is the Name of the subform control?
It may be different from the name of the form contained in the control (its
SourceObject.)

Error 438 suggests that the name is not correct. Perhaps the main form is
not named as expected, or there is no [tbl TB Del Data] on that form, or
[tbl TB Del Data] is not a subform control, or if it is it has no form in
it.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Kerry Purdy said:
Sorry, this is still not working.

I have a Training Booking Main Form, with a sub form of a delegate list
(this list is based on a query showing the Name and Company Name of
delegates).

I click a button to either add a new company booking or select a delegate
from an existing company to edit the booking by deleting or adding a new
delegate for that company. This works perfectly.

However, when I close the form (New or Edit Booking) I would like the
Delegate list to update automatically - this is not happening.

On a few of the events (close, after update etc.) of the TB Bookings form
I
have tried entering

Forms.[frm Training Booking (Main)].[tbl TB Del Data].Form.Requery

but this shows an error of run time error 438 - object does not support
this
property or method.

I would appreciate some help please. Thank you very much for your time.

Kerry


Allen Browne said:
When would you like it?

In the AfterUpdate event of the form that made the changes? (Be sure to
use
the *form* event, not that of a control.)

In the Click event of a button?

Kerry Purdy said:
On what event do I put this code please?

Thank you

Kerry


:

You can programmatically requery the subform Sub1 with this line of
code:
Me.[Sub1].Form.Requery

If it is on another form, use this kind of thing:
Forms.[Form1].[Sub1].Form.Requery


I have a subform based on a query, I click a button to open a
further
form,
allowing to edit the underlying records. When I close the
"edit-form"
I
want
the subform to update. I can only do it by pressing F9. I have
tried
me.refresh and me.requery on got focus, open, load. I am sure I am
being
dim
- I have searched the other questions but still no joy.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top