Results 1 to 8 of 8
  1. #1
    bginhb is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    May 2011
    Location
    Huntington Beach, CA, USA
    Posts
    47

    Totals in a multi-record sub form


    I am using a multi-record subform that does a lot of thing and all of them are working except one.

    This subform header section is used to display totals. There are 2 totals ... one uses a domain aggregate that pulls a total from all the records in the sub form and one that calculates a percentage based on the that one and a field in the main form.

    The calculations are forced to update using the subform OnCurrent event and the totals are (re)calculated using a requery of the text box controls containing the totals discussed above.

    Here's the problem ... the User can suspend the process at any time and return to it at his leisure but when he does and the subform loads the cursor is naturally placed in the first tab control of the multi-form and even though the OnCurrent event is supposed to have fired my total fields show either empty or error? Once the cursor moves to another record (whether tabbed to it or clicked) the totals are recalculated and appear just fine.

    Seems like an Access inconsistency or do I have to do something else to get the totals to update when the subform loads?

    Appreciate any help ... thank you
    Last edited by bginhb; 08-26-2011 at 11:33 AM. Reason: Clarifications

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    You can set the ON LOAD or ON OPEN property of your subform to perform the same updates that your data entry function does once the form is open and running.

  3. #3
    bginhb is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    May 2011
    Location
    Huntington Beach, CA, USA
    Posts
    47
    Thanks rpearre,

    I'm not sure I understand. My totals are updating based upon the datasource expression for the 2 controls and updating totals with re-queries of the 2 controls using the OnCurrent event. I'm not pushing the totals in with code or macros.

    I tried doing the re-queries in the OnLoad event as you suggested but the results were unchanged.

    Thanks for your input.

  4. #4
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    I'm not following what the problem is then based on what you've typed. Do you have a sample database you can upload (just make sure it has no private information in it) then zip it up and upload it to this forum.

  5. #5
    bginhb is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    May 2011
    Location
    Huntington Beach, CA, USA
    Posts
    47
    In the interest of time I can send you a screen snap that displays the nature of the problem. If I send you the complete DB I will also need to send you the login information and explain how it works and my time doesn't allow that for a few hours.

  6. #6
    ketbdnetbp is offline Competent Performer
    Windows 7 32bit Access 2003
    Join Date
    Mar 2011
    Location
    Midwest
    Posts
    254

    bginhb -

    Don't know why but, it appears as though the OnCurrent event of the subform isn't firing when "the cursor is naturally placed in the first tab control of the multi-form"? Don't know what that means exactly but, as a test, you might try this code...

    Dim strSubformControl As String
    strSubformControl = "nameofyoursubform"
    DoCmd.GoToControl strSubformControl
    DoCmd.GoToRecord acActiveDataObject, , acFirst
    'optional, set focus back to the main form or elsewhere as desired

    in the OnOpen event of the main form and see if it produces the desired results.

    Just a thought,

    Jim

  7. #7
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    The screen shot really doesn't do anything for my understanding but let me see if I get the gist.

    When you start a new record your form performs like you want it, no issues. If you hit the 'suspend' button I'm assuming you are basically closing the record to be completed at another time. When you then go back to update that record, whatever process you use to populate them is not doing so when you choose an existing record?

  8. #8
    bginhb is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    May 2011
    Location
    Huntington Beach, CA, USA
    Posts
    47

    Problem Solved

    It turns out that it was a timing problem. In the first field of the multi-form subform I was using a sendkeys {F2} to put the field in edit rather than replace mode. I chose to use a macro since it seemed easy and straightforward but the devil was in the options.

    The problem was alleviated by changing the pause parameter from no to yes. Simple as that but I still am not sure why not pausing caused Access to do what it did.

    Thank you for your assistance!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 08-14-2011, 12:15 AM
  2. Month totals and Year totals
    By marksnwv in forum Access
    Replies: 1
    Last Post: 08-05-2011, 10:13 AM
  3. Adding totals to a form from a subform
    By Niki in forum Access
    Replies: 13
    Last Post: 05-13-2011, 12:17 AM
  4. Multi-record additions using a list box not working right
    By avarusbrightfyre in forum Programming
    Replies: 3
    Last Post: 10-27-2010, 01:50 PM
  5. Group Totals in a form
    By mai1081 in forum Forms
    Replies: 1
    Last Post: 05-14-2008, 06:11 PM

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