Refresh All

M

meyerryang

I have a subform that shows up on a lot of different forms. If I change
something on the subform I want it to refresh everything. I know how to
refresh it on one form, but I want it to show up on all forms and refresh
everything on the form that it is on.

I have an idea and that is refresh the form by creating a dim.

Dim MasterForm as variant
MasterForm = subform's Master Form
Forms![subform's Master From].requery

This is where I get lost. Please help.
 
D

Dale Fye

How about:

me.parent.requery

The downside is that when you requery a form, the record that has the focus
will return to the first record in the recordset. So unless your main form
is filtered to return display only a single record, you are liable to change
the record focus of the main form.

If there are particular controls on the "master forms" that this subform
needs to requery, then you could use the name of the subforms parent to
determine what to do. Something like:

Dim strParentName as string

On Error Resume Next

strParentName = me.parent.name

Select Case strParentName
Case "form1"
forms(strParent).txt_Something.requery
case "form2"
forms(strParent).txt_Something_else.requery
Case else
'do nothing
end select




--
HTH
Dale

email address is invalid
Please reply to newsgroup only.
 
M

meyerryang

That was so easy. Thank you.

Dale Fye said:
How about:

me.parent.requery

The downside is that when you requery a form, the record that has the focus
will return to the first record in the recordset. So unless your main form
is filtered to return display only a single record, you are liable to change
the record focus of the main form.

If there are particular controls on the "master forms" that this subform
needs to requery, then you could use the name of the subforms parent to
determine what to do. Something like:

Dim strParentName as string

On Error Resume Next

strParentName = me.parent.name

Select Case strParentName
Case "form1"
forms(strParent).txt_Something.requery
case "form2"
forms(strParent).txt_Something_else.requery
Case else
'do nothing
end select




--
HTH
Dale

email address is invalid
Please reply to newsgroup only.



meyerryang said:
I have a subform that shows up on a lot of different forms. If I change
something on the subform I want it to refresh everything. I know how to
refresh it on one form, but I want it to show up on all forms and refresh
everything on the form that it is on.

I have an idea and that is refresh the form by creating a dim.

Dim MasterForm as variant
MasterForm = subform's Master Form
Forms![subform's Master From].requery

This is where I get lost. Please help.
 

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