?
Solved

Running Form code remotely

Posted on 2014-01-06
3
Medium Priority
?
430 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

How Blockchain Is Impacting Every Industry

Blockchain expert Alex Tapscott talks to Acronis VP Frank Jablonski about this revolutionary technology and how it's making inroads into other industries and facets of everyday life.

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.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

777 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