Group:  Microsoft Access ยป microsoft.public.access.formscoding
Thread: Refresh All

Geek News

Refresh All
meyerryang 12/8/2008 4:50:00 PM
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.
RE: Refresh All
Dale Fye 12/8/2008 8:13:02 PM
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" wrote:

[Quoted Text]
> 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.
RE: Refresh All
meyerryang 12/8/2008 9:30:02 PM
That was so easy. Thank you.

"Dale Fye" wrote:

[Quoted Text]
> 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" wrote:
>
> > 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.

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net