Ideally, I wanted the data to be passed real time when both subforms and my main form are open at the same time but not sure if i'll go mad in order to achieve that functionality.
Thanks very much. I am now able to get the text box values from the subforms to the REPORT and also can perform summary calc. However, one issue I have is that the forms should remain open. I will have over 8-10 subforms for components costing and if the user keeps all the forms open after performing estimation, it might be bit frustrating to them. Is there a way that I can save and close the form and then when I open the report the values still show up. I very highly appreciate for your time.
No simple method.
Set value of a Global variable. The global variable can be referenced in a function and the function can be called in a textbox.
Use TempVars - I've never used them. I'll let you do research on TempVars.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Thank you so much for being so helpful and for directions. I'll post you with my progress.
I made some progress with TempVars but got stuck here. I am confused if the Expression of TempVar can take a FORMULA or a TEXTBOX that contains a formula. The Textbox that I have in the EXPRESSION of my temporary variable contains a SUM formula, which is only calculated when an end user enters the product mark-up. However, I am don't getting any value from the TempVar. Therefore, I am confused if the TempVar Expression could even contain a 'textbox' that contains a formula. I have few screenshots to explain better:
FORM
TEMPVAR EXPRESSION
FORM:
Also, the FORM where I am calling the TempVar displays no value. This is what I have in Default value of the Textbox where I am calling the TempVar:
Default Value = [TempVars]![totalprice2]
Totalprice2 is my Temporary variable name.
Any suggestion would be greatly appreciated. Thank you!
Don't think you want to use default value. Try Control source on Data tab.
You mean where I am calling the Macro? I entered this formula = [TempVars]![totalprice2] in the Control Source of Textbox in a different form where I am calling the TempVar but it displays no value.
Do you manually update (type a value into) text24? If not, the afterupdate event will not happen. Updating by a formula calculation won't make it happen. In that case, tempvars!totalprice2 will never be set to a value.
I only manually update (enter the value) into Text21 (Mark-Up%), after which the Price$ (Text 25) is auto calculated thru the formula it contains. I am not manually entering a value into Text 25 (Price$) which the TempVar Expression is referring to.
Does that mean the TempVar will only be set to a value which is manually entered?
Hi
Into main form, create a tab control with 8 tabs. Into every of tabs, insert one subform. So user can select any subform simply by activating a proper tab.
I'm not sure you can close a subform without closing main form at all. And assuming this is possible, closing a form and then opening again when needed takes always some time - your app will probably slow down.
By doing this, will I be able to only display the Total Prices from different subforms to the main form, after the subform is updated and closed? I do not want to show all the fields of SUBFORMS in the MAIN FORM. I only want to display Total Price1, Total Price2, Total Price3, Total Price4 in the Main form, and these prices are calculated in the subforms.
Currently, I have referenced these prices in Main form Control source but the subforms has to remain open in order for Main Page to display the prices. Thanks for your time & help.
Hi
Into main form, create a tab control with 8 tabs. Into every of tabs, insert one subform. So user can select any subform simply by activating a proper tab.
I'm not sure you can close a subform without closing main form at all. And assuming this is possible, closing a form and then opening again when needed takes always some time - your app will probably slow down.
I only manually update (enter the value) into Text21 (Mark-Up%), after which the Price$ (Text 25) is auto calculated thru the formula it contains.
Then set the value of tempvar!totalprice2 in the afterupdate event of Text21 to the same value calculated for text25.
if I set the TempVar to Text21 (Mark-Up%) which is a manually entered textbox, how would I be able to call the value of Total Price (Text25) to the Main Form? Please advise.
I tried your suggestion of tab control and its nice to have all the individual costing forms in a single form through tab control. Thanks. However, I still want a summary page to show the following for me:-
Total Price1=
Total Price2=
Total Price3=
Total Price4=
Grand Total = Total Price 1+2+3+4
These Total Prices are calculated in subforms. Any advise?
Hi
Into main form, create a tab control with 8 tabs. Into every of tabs, insert one subform. So user can select any subform simply by activating a proper tab.
I'm not sure you can close a subform without closing main form at all. And assuming this is possible, closing a form and then opening again when needed takes always some time - your app will probably slow down.
Let's assume you have a table tblMain with MainID as primary key, and 8 tables tblSub1, ..., tblSub8, every one of them with it's own primary key, p.e. Sub1Id, MainID, ..., Price1.
You created a form fMain with tab control tbcMain. On every tab you have a subform, p.e. sfSub1 with fSub1 as form on 1st tab. At upper part of Main form you have along with controls bound to table tblMain unbound controls txtTotalPrice1, ..., txtTotalPrice8, txtGrandTotal, with DSum() function as ControlSource, p.e. =DSum("Price1", "tblSub1", "MainID = " & Me.MainID). Be aware, that the syntax for 3rd parameter - the one representing condition - depends on data type of field used to set the condition!
For every subform, you create an AfterUpdate event, which recalculates according unbound control on main form (Me.Parent.Form.txtTotalPrice1.Refresh) whenever a record on subform is saved/updated, and also the unbound control for grand total. Also you must have an OnCurrent event for Main form, which recalculates all unbound controls whenever a different record is activated on Main form.
Take all my example syntaxes with grain of salt, as I don't have currently access installed at my home computer.
In the afterupdate event for text21:I only manually update (enter the value) into Text21 (Mark-Up%), after which the Price$ (Text 25) is auto calculated thru the formula it contains.
It's hard to understand the process due to textbox control names like text25, text21, etc.Code:tempvars!totalPrice2 = text17 + text23 'calculate it just like text25
These should be named something like txtTotalPrice2 and txtMarkupPct. It would make things much less confusing.