subform not refreshing

  • Thread starter mav51 via AccessMonster.com
  • Start date
M

mav51 via AccessMonster.com

Hi there, I have a main form with a subform embedded to be able to scroll
through a list of records. There is no linking field between the two. The
subform displays all the records properly. One of the fields in the subform
is a checkbox to 'close' the record indicating that the info is no longer
current and shouldn't be displayed. This works fine. I should also mention
that the subform is based on a query.
I have a button on the main form which opens another modal form based on the
same query as the subform that will let me uncheck the checkbox in case the
record was 'closed' by accident and is actually still current. This works
also, when I check record A then close and reopen the main form record A is
gone. If I open the modal form, uncheck the appropriate box, close and
reopen the main form, record A is back.
My question is "Is it possible to have the main form, and by extension, the
subform reload so that record A reappears without having to close and reopen
the main form?"
I've tried setting the focus to the form/subform and running the requery
method with no success.

Any help is appreciated, thanks!
Michael
 
B

boblarson

You can requery the subform by using this syntax-

If the code is on the main form:

Me.YourSubformContainerName.Form.Requery

If the code is on another form:

Forms!YourSubformContainerName.Form.Requery

Where YourSubformContainerName is the name of the container control that
houses the subform on the main form and not the subform name (unless it is
the exact same name as the container, which they can be the same but aren't
necessarily so).
--
Bob Larson
Access World Forums Super Moderator
Utter Access VIP
Tutorials at http://www.btabdevelopment.com
If my post was helpful to you, please rate the post.
__________________________________
 
M

mav51 via AccessMonster.com

That did the trick, thanks!
You can requery the subform by using this syntax-

If the code is on the main form:

Me.YourSubformContainerName.Form.Requery

If the code is on another form:

Forms!YourSubformContainerName.Form.Requery

Where YourSubformContainerName is the name of the container control that
houses the subform on the main form and not the subform name (unless it is
the exact same name as the container, which they can be the same but aren't
necessarily so).
Hi there, I have a main form with a subform embedded to be able to scroll
through a list of records. There is no linking field between the two. The
[quoted text clipped - 16 lines]
Any help is appreciated, thanks!
Michael
 

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