Page 2 of 3 FirstFirst 123 LastLast
Results 16 to 30 of 32
  1. #16
    sud2017 is offline Competent Performer
    Windows 7 64bit Access 2003
    Join Date
    Jul 2017
    Posts
    148
    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.



    Quote Originally Posted by sud2017 View Post
    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.

  2. #17
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,956
    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.

  3. #18
    sud2017 is offline Competent Performer
    Windows 7 64bit Access 2003
    Join Date
    Jul 2017
    Posts
    148
    Thank you so much for being so helpful and for directions. I'll post you with my progress.


    Quote Originally Posted by June7 View Post
    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.

  4. #19
    sud2017 is offline Competent Performer
    Windows 7 64bit Access 2003
    Join Date
    Jul 2017
    Posts
    148
    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

    Click image for larger version. 

Name:	Capture1.PNG 
Views:	21 
Size:	30.7 KB 
ID:	29723

    TEMPVAR EXPRESSION

    Click image for larger version. 

Name:	Capture2.PNG 
Views:	19 
Size:	10.0 KB 
ID:	29724

    FORM:

    Click image for larger version. 

Name:	Capture3.PNG 
Views:	19 
Size:	7.3 KB 
ID:	29725


    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!

  5. #20
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,421
    Don't think you want to use default value. Try Control source on Data tab.

  6. #21
    sud2017 is offline Competent Performer
    Windows 7 64bit Access 2003
    Join Date
    Jul 2017
    Posts
    148
    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.

  7. #22
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,421
    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.

  8. #23
    sud2017 is offline Competent Performer
    Windows 7 64bit Access 2003
    Join Date
    Jul 2017
    Posts
    148
    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?

    Quote Originally Posted by davegri View Post
    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.

  9. #24
    Join Date
    Apr 2017
    Posts
    1,687
    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.

  10. #25
    sud2017 is offline Competent Performer
    Windows 7 64bit Access 2003
    Join Date
    Jul 2017
    Posts
    148
    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.


    Quote Originally Posted by ArviLaanemets View Post
    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.

  11. #26
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,421
    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.

  12. #27
    sud2017 is offline Competent Performer
    Windows 7 64bit Access 2003
    Join Date
    Jul 2017
    Posts
    148
    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.

    Quote Originally Posted by davegri View Post
    Then set the value of tempvar!totalprice2 in the afterupdate event of Text21 to the same value calculated for text25.[/COLOR]

  13. #28
    sud2017 is offline Competent Performer
    Windows 7 64bit Access 2003
    Join Date
    Jul 2017
    Posts
    148
    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?


    Quote Originally Posted by ArviLaanemets View Post
    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.

  14. #29
    Join Date
    Apr 2017
    Posts
    1,687
    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.

  15. #30
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,421
    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.
    In the afterupdate event for text21:
    Code:
    tempvars!totalPrice2 = text17 + text23      'calculate it just like text25
    It's hard to understand the process due to textbox control names like text25, text21, etc.
    These should be named something like txtTotalPrice2 and txtMarkupPct. It would make things much less confusing.

Page 2 of 3 FirstFirst 123 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Passing Data From One Form to Another
    By CharlieK in forum Access
    Replies: 19
    Last Post: 10-31-2016, 07:48 PM
  2. Passing Data From One Form to Another Form
    By ETCallHome in forum Forms
    Replies: 6
    Last Post: 03-12-2011, 12:53 PM
  3. Passing Data from on Form to Another..
    By ETCallHome in forum Forms
    Replies: 2
    Last Post: 03-12-2011, 12:26 AM
  4. Form not passing data to query
    By bobfin in forum Queries
    Replies: 13
    Last Post: 08-11-2010, 05:28 AM
  5. Passing data to sequential form fields
    By jeepfamilyva in forum Forms
    Replies: 0
    Last Post: 06-28-2009, 11:04 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums