Solved

Running Form code remotely

Posted on 2014-01-06
3
425 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

Back Up Your Microsoft Windows Server®

Back up 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.

Question has a verified solution.

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

Suggested Solutions

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…
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

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