Page 1 of 3 123 LastLast
Results 1 to 15 of 31
  1. #1
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664

    Calculations on Main form do not reflect calculations on subform

    In the tutorial shown here:http://www.functionx.com/access/Lesson37.htm, I have solved the

    problems getting values on the subform. I have not in getting values on the subform.



    For instance, on the one titled phone use the formula in the tutorial is:

    =[sbfCustomerRoomUse].[Form]![txtTotalPhoneUse]

    #Error results when the doc is put into a form mode.

    Now when I input each value in the equation above separately.

    I still get no entry.

    For " = sbfCustomerRoomUse" , I get #Error;

    and for "= txtTotalPhoneUse", I get #Name.



    I am not sure what is going on.

    CustomerRoomUse and txtTotalPhoneuse are from the subform that was dropped into the customer form in a previous step. It shows that explicitly
    when designed sbfCustomerRoomUse on the main that CustomerRoomUse come from a subform. This does not seem to need to be
    done with txtTotalPhoneuse, and I am not sure why. Neither one gives me a desired calculation result.

    Where am I going wrong?

    Thanks in advance.

    R,

    Lou Reed

  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,929
    These statements are confusing: "I have solved the problems getting values on the subform. I have not in getting values on the subform."

    Exactly which section and item have the instructions connected to this issue?
    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
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    The calculations for the suubform are solved and have been checked by me. They are solid.

    The corrected subform sbfcustomersRoomUse was dragged and dropped on the Customers form which also has some calculations. Please note these main form calculations use values from the subform sbfcustomersRoomUse .

    Since I used the formulas directly from the tutorial (and we know the tutorial has some errors) I would think they would be
    correct. I am mistaken. I get either of two messages that I listed above #Error and #Name.

    I am guessing there is a disconnect between the two forms. What else could it be?

    Any reason this is not working?

    R,


    Lou Reed

  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,929
    Either tell what section in the instructions to review or provide the db for analysis or both.
    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
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664

    Main form calculations are misssing

    The document is attached. Any help on the calculations Phone Use, Internet Use, Rate Total and Net Pay as shown below the customers subform is appreciated.

    They are not coming out as expected.

    R,

    Lou Reed
    Attached Files Attached Files

  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,929
    Problem with expression in RateTotal is you are not referencing the subform name and also the () are not appropriate.

    The controls on subform are named txtsbfPhoneUse, txtsbfTotalInternetFee - expressions on main form reference txtTotalPhoneUse and txtTotalInternetFee

    Need to rename the controls on main form from Text28 and Text30 to txtInternetUse and txtRateTotal.

    I always name subform container control different from the object it holds, like: ctrRoom
    Then expression in textbox:
    =[ctrRoom]![txtsbfPhoneUse]
    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
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    Taking the first, you mean to remove () on the RateTotal calculation. I am not sure how that got in. My error.

    Then the correct answer for Rate Total is:

    =[sbfCustomerRoomUse].[Form]![txtsbfTotalRateApplied]

    The txtTotalRateApplied is changed to txtsbfTotalRateApplied to reflect that it comes
    from the subform.

    Is this correct?

    R,

    Lou Reed

  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,929
    Make sure expressions correctly reference control names.

    The control on subform is named txtTotalRateApplied - does not have sbf. Be consistent in naming.
    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
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    Yes, but on the main form (when txtTotalRateAppli is used on the main form) it must be called txtsbfTotalRateApplied. This reflects its origin on the subform.

    Is this correct?

    R,

    Lou Reed

  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,929
    Name the controls whatever you want. Again, be consistent. Make sure expressions reference the actual name of control you want to pull value from.
    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
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    Okay, but if you use a control from a subform named txtWhatYouMayCallIt, on the main form, somewhere in there it must an sbf such as txtsbfWhatYouMayCallIt.

    Yes consistency is one thing, but it control from subform being used on a main form must be identified as coming from the subform; hence sbf.

    Correct?


    R,


    Lou Reed

  12. #12
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664

    What is wrong with this error?

    This is an updated version of the database shown in tutorial linked in above post. The Internet Use seems to be calculated in a very similar way to Phone Use.
    Yet it is still not calculating, it is just showing an error. I did in a manner similar to Phone Use, but it did not work.

    What is wrong?

    R,

    Lou Reed
    Attached Files Attached Files

  13. #13
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    No. Does not have to use sbf in any name.

    The main and sub form textboxes can have the exact same names - it is the subform container name prefix that clarifies which textbox is being referenced.

    However, if using sbf in either the main or sub form textboxes names helps you keep track of things then use it. Be consistent. If the subform textbox has sbf in name then the expression on main form would be:

    =[sbfCustomerRoomUse].[Form]![txtsbfTotalRateApplied]

    You are not being consistent in naming convention. Subform has textbox names: txtTotalRateApplied, txtsbfPhoneUse, txtsbfTotalInternetFee

    And expressions on main form reference: txtRateApplied, txtsbfPhoneUse, txtsbflInternetFee

    The only expression that has correct reference is phone.
    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.

  14. #14
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    Please explain the subform container.

    Respectfully,


    Lou Reed

  15. #15
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Again, use of sbf in a name is your CHOICE. If that's the convention you want to implement in your db, then do so. I don't.

    A subform/subreport is created by placing a subform/subreport container control on a form/report. The container has a SourceObject property. This can reference a table, query, form, report. The container has Master/Child Links properties that will synchronize related records from main form and SourceObject.
    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.

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

Similar Threads

  1. Replies: 8
    Last Post: 03-13-2013, 08:32 AM
  2. Replies: 7
    Last Post: 12-28-2011, 02:05 PM
  3. Form/Subform Calculations
    By sidewayzalex in forum Forms
    Replies: 0
    Last Post: 08-15-2011, 01:11 PM
  4. subform calculations
    By genesis in forum Forms
    Replies: 0
    Last Post: 12-03-2009, 07:18 PM
  5. Subform calculations
    By foureyes in forum Forms
    Replies: 4
    Last Post: 07-27-2009, 08:20 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