Refresh form/subform information after update

R

Rose B

I have a form that has a subform contained within a tab. The tab (and
subform) is only visible if a flag is set on the main form. As an 'after
update' event on a control on the main form the flag may be set. How can I
get the tab/subform to now show for that record? Sometimes there is
additional processing done from a pop up/modal form which sets content for
the sub form and so the tab/sub form should not be shown until the completion
of that processing.

I hope that the above makes sense!
 
M

Marshall Barton

Rose said:
I have a form that has a subform contained within a tab. The tab (and
subform) is only visible if a flag is set on the main form. As an 'after
update' event on a control on the main form the flag may be set. How can I
get the tab/subform to now show for that record? Sometimes there is
additional processing done from a pop up/modal form which sets content for
the sub form and so the tab/sub form should not be shown until the completion
of that processing.


You can refresh the existing records in a subform by using
this kind of syntax:
Me.subformcontrol.Form.Refresh

If you want the subform to display new and remove deleted
records along with the updates, then use Requery instead of
Refresh.

Note: either one should save any changes to the current
record before displaying the updated records(s).
 
T

tina

well, you didn't say when or how the popup modal form is opened. if it
happens automatically, and in the same code that sets the flag, then you can
just add the subform.visible code to the same event. something along the
lines of

DoCmd.OpenForm "Name of popup modal form"
Me!NameOfFlagControl = <the flag value>
Me!SubformControlName.Visible = Yes

because the popup form is modal, once the OpenForm code executes, the rest
of the code will not execute until the popup form is closed again.

hth
 
J

Jeanette Cunningham

Hi Rose,
a tab control has pages numbered from 0 to ... however many pages
To show the 1st page of a tab control-->
Me.NameOfTabControl = 0
- above code is called from the main form.

To show a different page of the tab control
Me.NameOfTabControl = n
where n is the number for the page, remembering that the first page is 0.

When you are ready to show that subform, use
Me.NameOfTabControl = n
- replace 'n' with the correct number.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 
R

Rose B

Hi Jeanette,

I don't think I had explained myself very well. The tab visibility is
controlled through a flag either being true, or not, the flag is a field on
the main form. That flag is set during a 'conversation' with the user via a
pop up/modal form. What I want to be able to do is to refresh the main form,
and leave it on the same record that the user was on, such that if the flag
has been set to true, the tab that was previously hidden will now be
revealed, and the data within the subform contained within the the tab will
also be up to date.

I hope that is a bit clearer - it is hard to describe something at in words!
 
R

Rose B

'I suppose what I want to be able to do is to run the main form's On Current'
event processing as the last step of the pop up/modal form's processing. Is
this possible?
 
J

Jeanette Cunningham

If I am understanding your post, you can do this in the unload event for the
popup/modal form. You can requery the main form like this-->
Forms!NameOfMainForm.Requery

That will update the data for the main form.

Re showing the tab.
Is your tab control completely hidden, or is it just one tab that is hidden.
Not sure I'm understanding what you're trying to do here.

Would you post the code that currently flags that it's time to show the
subform on the tab?

Note: replace the object names with your names.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 

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

Top