Results 1 to 7 of 7
  1. #1
    libraccess's Avatar
    libraccess is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2012
    Location
    Napier New Zealand
    Posts
    129

    Recalculating fields in a subform

    I do not even know how to explain this one, so I have attchd a (much pared down ) version
    The idea is to calculate delivery costs and apportion. I know I,m trying to store calc fields in a table ( I know it's a no no)

    So this works if the user is prepared to enter deliveries in the subform and then go back to the start and tab right through (not acceptable)
    I have my calc controls recalc in the subform as I go but because I write the values to the table as I go through the subform once I move to the next subform record the value does not update


    are you confused cause I sure am

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,610
    I know I,m trying to store calc fields in a table ( I know it's a no no)
    If you already know this, why don't you change it?
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    libraccess's Avatar
    libraccess is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2012
    Location
    Napier New Zealand
    Posts
    129
    I found a thousand ways that would not work, then breaking the rules I found a way that did, sort of.
    The problem here is e.g. the subform has three records for the main forms one. the first record is entered and calculations occur, the second record is entered and both 1st and 2nd need to be recalculated, then the third requires the 1st and 2nd to be recalculated.
    As I say if I go back to record 1 and tab all the way thru the totals are correct.

  4. #4
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,610
    Can you post a copy of the db in A2003 mdb format.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  5. #5
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Quote Originally Posted by libraccess View Post

    ...I have my calc controls recalc in the subform as I go...
    How? To recalculate derived Fields on a Form you would use simply use the Command

    Me.Recalc

    and a search of your code does not find this anywhere. It can be placed anywhere within the code of the Form, or Form the Subform is based on, and will re-calculate all values on that Form.

    Linq ;0)>

  6. #6
    libraccess's Avatar
    libraccess is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2012
    Location
    Napier New Zealand
    Posts
    129
    Ok I have not looked at recalc before, I have refresh and requery in my scope but have just finished reading thishttps://599cd.com/tips/access/requery-v-refresh

    which is a brief but good expl. so I will give the form a rework ( there are some things in there that can go it has become a bit messy with trying a few things here and there. I will post how I go

  7. #7
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    I think you'll find it does the job! It'll recalculate everything on the given Form, with no references to any Controls needed, and unlike Requery, it doesn't move the Record-pointer back to the beginning of the RecordSet.

    Linq ;0)>

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

Similar Threads

  1. Replies: 1
    Last Post: 06-04-2012, 12:43 AM
  2. Sum fields in subform if not Null
    By atom in forum Forms
    Replies: 6
    Last Post: 02-10-2012, 04:03 PM
  3. Hiding fields in a subform
    By degras in forum Forms
    Replies: 7
    Last Post: 01-18-2011, 10:55 AM
  4. How to link subform using two fields
    By rohnds in forum Forms
    Replies: 1
    Last Post: 08-04-2010, 04:44 AM
  5. Accessing subform fields
    By nkenney in forum Forms
    Replies: 1
    Last Post: 04-21-2009, 10:10 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