Solved

Running Form code remotely

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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Suggested Solutions

It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Familiarize people with the process of utilizing SQL Server functions 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 Microsoft Ac…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …

867 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

24 Experts available now in Live!

Get 1:1 Help Now