Page 1 of 3 123 LastLast
Results 1 to 15 of 32
  1. #1
    sud2017 is offline Competent Performer
    Windows 7 64bit Access 2003
    Join Date
    Jul 2017
    Posts
    148

    Passing data from one FORM to another FORM

    Hi Expert,

    Reposting from my other post/forum with more details as the original question was unanswered possibly due to lack of details.



    Below Image 1 is my main form, and Image 2 is my subform. I need the RED circled textbox VALUE from the subform (image 2) to be PASSED on to the RED circled textbox in my main form (image 1). Both forms are unrelated. This might be an easy fix but I'm struggling for quite sometime and need to fix to meet my project deadline. Any help will be much appreciated.

    IMAGE 1 - Main FORM
    Click image for larger version. 

Name:	img1.jpg 
Views:	45 
Size:	52.9 KB 
ID:	29661

    IMAGE 2 - SUBFORM
    Click image for larger version. 

Name:	image2.jpg 
Views:	45 
Size:	55.6 KB 
ID:	29663

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,964
    Why do you need to do this? What expression is in the main form textbox ControlSource?

    Referencing subform controls and fields must be done by referencing the subform container control. Advise naming the control different from the object it holds, like ctrWork. Then expression like:

    =[ctrWork].Form.[control name]

    or

    =[ctrWork]![field name]
    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. #3
    sud2017 is offline Competent Performer
    Windows 7 64bit Access 2003
    Join Date
    Jul 2017
    Posts
    148
    The reason I want to do this is because the MAIN FORM provides me the TOTAL COST of the PROJECT and the subforms perform the component-wise cost estimation for various components of the Project.

    Expression in the Main Form ControlSource is =form!WC1F1!Text15

    WC1F1 is name of my subform and Text15 is the textbox where I want the data to come from to the Main Form.

    I didn't quite understood the container control you suggested so any further direction would be appreciated. Thank you!

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,964
    A subform/subreport is created by installing a subform/subreport container control on a form. The container has SourceObject property which can reference a table, query, form, or report. Just like other controls (textbox, combobox, etc) the container has a Name property.

    But do you not really have a form/subform arrangement? Is your 'subform' really just a form that is opened independently?

    Are you trying to save this Total to a field? Shouldn't. The value should be calculated when needed.
    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.

  5. #5
    sud2017 is offline Competent Performer
    Windows 7 64bit Access 2003
    Join Date
    Jul 2017
    Posts
    148
    Thanks for the clarification June7. I don't have a form/subform arrangement and my subform is just a form that is opened independently. All I need is that the value for COST from the subforms to be passed on to my MAIN FORM, where I can calculate the SUM of all COMPONENTS COSTS that's coming from subforms and print a report for user from Main Form.

    I feel like it should be fairly simple but I am beginner in Access so not sure how to do it.

    Quote Originally Posted by June7 View Post
    A subform/subreport is created by installing a subform/subreport container control on a form. The container has SourceObject property which can reference a table, query, form, or report. Just like other controls (textbox, combobox, etc) the container has a Name property.

    But do you not really have a form/subform arrangement? Is your 'subform' really just a form that is opened independently?

    Are you trying to save this Total to a field? Shouldn't. The value should be calculated when needed.

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,964
    Are you trying to print the form? Forms are intended for screen display. Reports are intended for print output. Each can be made to work somewhat like the other but not as effectively.

    As I stated, calculate the Total when needed. It is not necessary to display on main form. Do this calculation in query or report design.

    The expression you tried requires the 'subform' to remain open. And slight error in your syntax, should be: Forms!WC1F1!Text15
    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.

  7. #7
    sud2017 is offline Competent Performer
    Windows 7 64bit Access 2003
    Join Date
    Jul 2017
    Posts
    148
    Thanks again for the insight. When performing calculations in a query or report design, it only allows me to choose the TABLE or QUERY where the data will come from, but I want the data to come from a TEXTBOX from a FORM. The value that is calculated in this TEXBOX is not stored in any TABLE or QUERY.

    In my report, I want the COST data to come from the subforms. Kindly advise.

    Quote Originally Posted by June7 View Post
    Are you trying to print the form? Forms are intended for screen display. Reports are intended for print output. Each can be made to work somewhat like the other but not as effectively.

    As I stated, calculate the Total when needed. It is not necessary to display on main form. Do this calculation in query or report design.

    The expression you tried requires the 'subform' to remain open. And slight error in your syntax, should be: Forms!WC1F1!Text15

  8. #8
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,964
    And it should not be stored, it should be calculated - in query or textbox.

    Use report Sorting and Grouping features with aggregate calcs in form and group header/footer sections. Report allows display of detail data as well as summary calculations.

    Open report with filter criteria applied as appropriate for your desired output.
    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.

  9. #9
    sud2017 is offline Competent Performer
    Windows 7 64bit Access 2003
    Join Date
    Jul 2017
    Posts
    148
    Ok. I'll have to explore these features of REPORTS. Hopefully it allow me to perform and display the summary calculation based on the components costing values from different subforms. I will post you as I make some progress with this. Thanks so much again for your time.

    Quote Originally Posted by June7 View Post
    And it should not be stored, it should be calculated - in query or textbox.

    Use report Sorting and Grouping features with aggregate calcs in form and group header/footer sections. Report allows display of detail data as well as summary calculations.

    Open report with filter criteria applied as appropriate for your desired output.

  10. #10
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,964
    Might need subreports.

    Expression in textbox on report can reference the open 'subform' textbox.

    VBA code behind 'subform' can set value in textbox on 'main' form before the 'subform' closes.
    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.

  11. #11
    sud2017 is offline Competent Performer
    Windows 7 64bit Access 2003
    Join Date
    Jul 2017
    Posts
    148
    Could you recommend any tutorial/video on how I can perform summary calculation in a REPORT from the data that's from TEXTBOX of FORMS and not from any TABLE OR QUERY. All links I could find online only talk about using records from TABLE/QUERY. Thank you again for your time.


    Quote Originally Posted by June7 View Post
    And it should not be stored, it should be calculated - in query or textbox.

    Use report Sorting and Grouping features with aggregate calcs in form and group header/footer sections. Report allows display of detail data as well as summary calculations.

    Open report with filter criteria applied as appropriate for your desired output.

  12. #12
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,964
    Cannot do 'summary' calc of data from form textbox. The report textbox can reference a textbox on form using the same expression you posted earlier - as corrected in post 6.
    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.

  13. #13
    sud2017 is offline Competent Performer
    Windows 7 64bit Access 2003
    Join Date
    Jul 2017
    Posts
    148
    I am hoping that when the COST is calculated in subform, and I SAVE and CLOSE the FORM, it will pass that calculated value to Main Form or Report in order to perform a summary calculation with other COSTS that's coming from other subforms. I never thought this will be so difficult in ACCESS or possibly I'm not on right track

    Quote Originally Posted by June7 View Post
    Might need subreports.

    Expression in textbox on report can reference the open 'subform' textbox.

    VBA code behind 'subform' can set value in textbox on 'main' form before the 'subform' closes.

  14. #14
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,964
    As already stated, code in subform can set value in main textbox before the subform closes.

    Or leave the subform open and report textbox references subform textbox.

    What is 'right' is what works for you although a purist might say the 'right' track is to calculate the total in report design, which is usually quite simple but I don't know enough about your db structure.
    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.

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

    Quote Originally Posted by June7 View Post
    Cannot do 'summary' calc of data from form textbox. The report textbox can reference a textbox on form using the same expression you posted earlier - as corrected in post 6.

Page 1 of 3 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