Solved

Requery Main Form from SubForm

Posted on 1998-12-17
4
364 Views
Last Modified: 2012-05-04
I can't get a requery to occur on a main form from the AfterUpdate event of a control on the subform.  I have a control on the main form that is a calculated field, SUM(), for an aggregate, SUM()again, in the underlying query.
0
Comment
Question by:elise061298
  • 2
4 Comments
 
LVL 8

Expert Comment

by:Helicopter
ID: 1971385
have you tried me.parent.yourcontrol.requery?
0
 
LVL 1

Expert Comment

by:surrealism
ID: 1971386
or try Me.Parent!yourcontrol.ReQuery where yourcontrol is a calculated control on the main form

0
 

Accepted Solution

by:
ABE2276 earned 100 total points
ID: 1971387
the way out is: create a summary field (hidden if you don't want to show it) in the subform - for ex.
fld2 with datasource=fld0*fld1
  place the following code in AfterUpdate Event for fld0, fld1:
  private sub fld0_AfterUpdate()
    me.recalc
  end sub
  private sub fld1_AfterUpdate()
    me.recalc
  end sub
  that will requery your subform's calculation field every time
  you change values in fld0, fld1
create field fld3 in your main form and place the following in
datasource property (let your subform name be sbfrm):
  = sbfrm.form![fld2]  
i guess that's the way out.

best regards, ABE
0
 

Expert Comment

by:ABE2276
ID: 1971388
oops !
please, replace datasource for fld2=sum(fld0*fld1)
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

760 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

18 Experts available now in Live!

Get 1:1 Help Now