Solved

requery subform 2 levels down.

Posted on 2009-03-31
3
990 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
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…

867 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now