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
Solved

requery subform 2 levels down.

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
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 utilizing SQL Server views 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 Microsoft Access…
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…

856 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