Results 1 to 8 of 8
  1. #1
    Richard_Marx is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jul 2013
    Posts
    36

    Have Field Sum Other Fields On FOrm


    I am attempting to have my field txtSum equal txtValueOne + txtValueTwo. I set the default value of txtSum =NZ([txtValueOne],0)+NZ([txtValueTwo],0) but txtSum is not auto-calculating. The control Source for my field is set to SUM as that is the database field I need this value to be stored in.

    What do I need to change on my form so that txtSum auto-updates based off the value(s) entered in txtvalue one and txtvaluetwo?

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 7 32bit Access 2013
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,614
    Use your expression:
    =NZ([txtValueOne],0)+NZ([txtValueTwo],0)
    as the control source setting txtSum
    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
    Richard_Marx is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jul 2013
    Posts
    36
    Quote Originally Posted by Bob Fitz View Post
    Use your expression:
    =NZ([txtValueOne],0)+NZ([txtValueTwo],0)
    as the control source setting txtSum
    Ah - ingenious! Will this still update my database table tblData with the value that txtSum calculates?

  4. #4
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 7 32bit Access 2013
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,614
    Quote Originally Posted by Richard_Marx View Post
    Ah - ingenious! Will this still update my database table tblData with the value that txtSum calculates?
    No it will not save the calculation. Generally it is not considered to be good practice to save calculations. Better to recalculate whenever and wherever required.
    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
    Richard_Marx is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jul 2013
    Posts
    36
    Quote Originally Posted by Bob Fitz View Post
    No it will not save the calculation. Generally it is not considered to be good practice to save calculations. Better to recalculate whenever and wherever required.
    How would I re-calculate so the value get's saved in my table?

  6. #6
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 7 32bit Access 2013
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,614
    Quote Originally Posted by Richard_Marx View Post
    Ah - ingenious! Will this still update my database table tblData with the value that txtSum calculates?
    No it will not save the calculation. Generally it is not considered to be good practice to save calculations. Better to recalculate whenever and wherever required.
    IMHO the best way of doing it would be to create a calculated field in the query that the form is based on.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  7. #7
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 7 32bit Access 2013
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,614
    Sorry I missed your post #5
    Quote Originally Posted by Richard_Marx View Post
    How would I re-calculate so the value get's saved in my table?
    You don't. Recalculate whenever and wherever needed
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  8. #8
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 7 32bit Access 2013
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,614
    The following link may be of interest to you: http://allenbrowne.com/casu-14.html
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

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

Similar Threads

  1. Replies: 2
    Last Post: 10-09-2015, 04:47 PM
  2. Replies: 9
    Last Post: 08-25-2014, 05:09 PM
  3. Form Field showing all table fields
    By DMJ in forum Forms
    Replies: 7
    Last Post: 03-25-2014, 03:57 PM
  4. Replies: 1
    Last Post: 11-01-2011, 05:55 PM
  5. Autofill form fields based on another field
    By ljs1277 in forum Access
    Replies: 3
    Last Post: 02-16-2010, 02:51 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