468,135 Members | 1,466 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,135 developers. It's quick & easy.

requery a subform on a form

ken
Hi,
I have a main form with a text box and a filter button. I also have a
subform in the main form. When I make an entry into the filter text box
and click the filter button, I change the query definition of the
subform and then try to requery the subform, but no matter what I do it
does not requery?

While my main form is open and after I clicked on filter, I can open
the subform query and see that the sql changed correctly. I can open
the subform itself and its filtered correctly, but the subform on my
main form won't change unless I close and reopen the main form?

Does this mean that is I changed the SQL behind a query in a form I
can't see it untill I reopen the form?

Nov 13 '05 #1
3 12450
ken
Found an answer to question(This worked for me):

Steven Hemingray Jun 14 2001, 7:31 am show options
Newsgroups: microsoft.public.access
From: hall...@hotmail.com (Steven Hemingray) - Find messages by this
author
Date: 14 Jun 2001 05:31:51 -0700
Local: Thurs, Jun 14 2001 7:31 am
Subject: Re: Refreshing a subform
Reply to Author | Forward | Print | Individual Message | Show original
| Report Abuse
And where should I put that? Under the current buttons code? "Bruce M. Thompson" <NO~SPAM_bthmp...@bigfoot.com> wrote in message
news:0V***************@newshog.newsread.com...
Mike: A simple "Me.NameOfSubformControl.Requery" should take care of that. This

will,
in effect, reopen the subform instance.


Try putting it in the afterupdate field of the main form, or if there
is a command button used to change the data, put it at the bottom of
that.
I had a problem with this as well where just doing a requery didn't
work for me. If that's the case for you as well, put this in the
afterupdate field or the command button code:
me.subformname.form.recordsource = queryname

Also, subformname here is the name of the subform control, which isn't
always the same as the name of the form itself.

-Steven

Nov 13 '05 #2
On 7 Sep 2005 19:37:52 -0700, "ken" <ge****@gmail.com> wrote:
Hi,
I have a main form with a text box and a filter button. I also have a
subform in the main form. When I make an entry into the filter text box
and click the filter button, I change the query definition of the
subform and then try to requery the subform, but no matter what I do it
does not requery?

While my main form is open and after I clicked on filter, I can open
the subform query and see that the sql changed correctly. I can open
the subform itself and its filtered correctly, but the subform on my
main form won't change unless I close and reopen the main form?

Does this mean that is I changed the SQL behind a query in a form I
can't see it untill I reopen the form?

Requery the subform in code.
After you have changed the SQL of the subform's query, add a line like
-
Me.frmMySubForm.Form.Requery
Nov 13 '05 #3
ken
that does not work unless I have me.subformname.form.recordsource =
queryname before Me.frmMySubForm.Form.Requery

I don't know why, but if you do..please explain. Thanks

Nov 13 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Michelle | last post: by
2 posts views Thread by F. Michael Miller | last post: by
1 post views Thread by Johnny Meredith | last post: by
14 posts views Thread by Kurt | last post: by
1 post views Thread by Parasyke | last post: by
27 posts views Thread by didacticone | last post: by
1 post views Thread by gcdp | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.