?
Solved

requery subform 2 levels down.

Posted on 2009-03-31
3
Medium Priority
?
1,011 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 1000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
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…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Suggested Courses

764 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