Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Running Form code remotely

Posted on 2014-01-06
3
Medium Priority
?
433 Views
Last Modified: 2014-01-07
I have a subform that collects some data from the main form. when I change or enter information into the subform code runs to check various stuff on the subform and to calculate new subform totals.

The problem arises when something changes in the main form that should effect calculations in the subform . It does not of course because the subform code will not run unless procedures in the subform are activated by entering data in the controls.

In the subform I have a procedure called CGlass which recalculates the price of glass when the sizes in the subform change. I want this procedure to run when I change an overall size in the main form That should change the sizes in the subform and then recalculate the glass price.

So can I run a suform procedure and refresh the subform from the main form?
0
Comment
Question by:DatabaseDek
[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
3 Comments
 
LVL 29

Accepted Solution

by:
IrogSinta earned 1600 total points
ID: 39759300
Set your subform procedure CGlass to Public and call it from your main form this way:
Call Me.NameOfSubformControl.Form.CGlass
0
 
LVL 48

Assisted Solution

by:Dale Fye
Dale Fye earned 400 total points
ID: 39759312
If your subform is not linked to the main form, and what is displayed in the subform should depend on what is displayed in the main form, then from those controls on the main form that should influence the subform, you should requery the subform, using the AfterUpdate event, something like:

Private Sub txt_MainFormControl_AfterUpdate

    me.NameOfSubformControl.Form.requery

End Sub

Note:  "NameOfSubformControl" should be replaced by the value in the Name property of the subform control, when it is displayed in design view, on the main form.  This may be (but is not necessarily) the name of the form that shows up in the "SourceObject" property of the subform control.
0
 

Author Closing Comment

by:DatabaseDek
ID: 39761857
Thank you both.

Brilliant as usual!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
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.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

618 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