Solved

Requery Main Form from SubForm

Posted on 1998-12-17
4
407 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
[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
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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

724 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