Solved

Running Form code remotely

Posted on 2014-01-06
3
419 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
3 Comments
 
LVL 29

Accepted Solution

by:
IrogSinta earned 400 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 47

Assisted Solution

by:Dale Fye (Access MVP)
Dale Fye (Access MVP) earned 100 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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
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…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
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.

759 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

19 Experts available now in Live!

Get 1:1 Help Now