Solved

Requery Main Form from SubForm

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

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

Suggested Solutions

Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

910 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