Solved

requery subform 2 levels down.

Posted on 2009-03-31
3
992 Views
Last Modified: 2013-11-28
Hello,

I'm trying to requery a subform two levels down from an onclose even on a popup form.
the rest of the onclose event is in a macro.
I would like it to be in vba, but for some reason my settempvars isn't working in vba, so i'm stuck with a macro.  (will be another question)

So for now, i'm using the macro to 'run code' ie. call a function in which I am trying to do the requery.

from ms help "
If you want to requery a control that isn't on the active object, you must use the Requery method in a Visual Basic for Applications (VBA) module, not the Requery action or its corresponding Requery method of the DoCmd object. "

Info:
parent form : frmmain - view normal
subform 1   : frmtallysheetlist - view normal
subfrom 2   : sbfrmtallysheetlist - view datasheet
popupform  : frmtallysheetcreator

the event is triggered on the onclose event of the popup form.
subform 2 is a subform of subform 1 which is a subform of frmmain.
subform 2 's recordsource is a query.

My code below did not work.

Thank you.
Function refreshtallysheetlist()
On Error GoTo refresh_Err
 
frmtallysheetlist.Form!sbfrmtallysheetlist.Form.Requery
refresh_Exit:
    Exit Function

Open in new window

0
Comment
Question by:jpostuma
  • 2
3 Comments
 
LVL 28

Expert Comment

by:TextReport
ID: 24030497
You need to reference the Forms collection and confirm that your control names are all the control names which may not be the same as the form name.

Forms!frmtallysheetlist.Form!sbfrmtallysheetlist.Form.Requery

Cheers, Andrew
0
 
LVL 28

Accepted Solution

by:
TextReport earned 250 total points
ID: 24030511
Sorry missed the main form

Forms!frmmain!frmtallysheetlist.Form!sbfrmtallysheetlist.Form.Requery

Cheers, Andrew
0
 

Author Closing Comment

by:jpostuma
ID: 31564903
Perfect thanks.
that subform control always gets me too.  It was named differently in order to change subforms.
Thanks.
0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question