Refresh All

  • Thread starter Thread starter meyerryang
  • Start date Start date
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.
 
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.
 
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.
 
Back
Top