Solved

requery subform 2 levels down.

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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
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…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

706 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

16 Experts available now in Live!

Get 1:1 Help Now