Results 1 to 13 of 13
  1. #1
    aliaslamy2k is offline Advanced Beginner
    Windows 7 32bit Access 2013 32bit
    Join Date
    Apr 2020
    Posts
    31

    Sum of all Text Box

    Dear Experts,

    I need help. How can i get the sum of all Textbox in a form. Below is what i have done.
    I want to display the total of :

    45140
    33090
    18400
    20600
    4980


    1680
    Attached Thumbnails Attached Thumbnails 1.JPG   2.JPG  

  2. #2
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,388
    try =CLng(Me.text29) + CLng(Me.text31)+ CLng(Me.text33)...

  3. #3
    aliaslamy2k is offline Advanced Beginner
    Windows 7 32bit Access 2013 32bit
    Join Date
    Apr 2020
    Posts
    31
    Hi davegri,

    Thank you for your response. I tried your formula but unfortunately it gives me an error.
    Attached Thumbnails Attached Thumbnails 3.JPG   4.JPG  

  4. #4
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,388
    Try just one textbox and see if that works. If so, then include another and another until error occurs. Maybe one (or all) the textbox names are not what you anticipate.

    Another approach if you're willing to use VBA:
    Make all 9 textboxes on the form Unbound
    In the Form_Current event
    Dim 8 variables as long, such as v1, v2, v3, etc
    Do the DSums into each of the 8 variables
    Then
    me.text29=v1
    me.txt31=v2
    ...
    Then
    Me.Total = v1+v2+v3...
    Last edited by davegri; 05-17-2020 at 02:07 PM. Reason: clarif

  5. #5
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,101
    Try to skip the Me. as Me is only available in VBA.

    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  6. #6
    aliaslamy2k is offline Advanced Beginner
    Windows 7 32bit Access 2013 32bit
    Join Date
    Apr 2020
    Posts
    31
    I tried multiple combinations, but still giving me an error and i am not much familiar with VBA codes.
    Attached Thumbnails Attached Thumbnails 5.JPG   6.JPG  

  7. #7
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,101
    Instead of all of those dSums why don't you build a totals query to sum them all up and then you can add up the fields in that query to give you the grand total.
    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  8. #8
    CarlettoFed is online now Competent Performer
    Windows 7 64bit Access 2013 32bit
    Join Date
    Dec 2019
    Posts
    255
    Maybe if you attach an example file you will understand what you have done and therefore help you

  9. #9
    aliaslamy2k is offline Advanced Beginner
    Windows 7 32bit Access 2013 32bit
    Join Date
    Apr 2020
    Posts
    31
    Hi Carletto,

    Please find below link for sample file

    https://we.tl/t-9HYj3VhWvo

  10. #10
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,530
    Quote Originally Posted by aliaslamy2k View Post
    Hi Carletto,

    Please find below link for sample file

    https://we.tl/t-9HYj3VhWvo
    I think it may be better to attach your db to a post here, rather than at a third party site.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  11. #11
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,388
    Problem is null fields. Your posted example shows no nulls, but the download does.
    Do it this way to account for nulls:
    =Nz([text33])+Nz([Text35])+Nz([Text37])+Nz([Text39])+Nz([Text41])+Nz([Text43])

  12. #12
    aliaslamy2k is offline Advanced Beginner
    Windows 7 32bit Access 2013 32bit
    Join Date
    Apr 2020
    Posts
    31
    Hi Davegri,

    Thank you soo much! This work perfectly.

    Thanks a million

  13. #13
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,388
    Glad to help. Good luck with the project!

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

Similar Threads

  1. Replies: 15
    Last Post: 02-17-2019, 06:19 PM
  2. Replies: 1
    Last Post: 05-18-2016, 09:46 AM
  3. Replies: 2
    Last Post: 07-09-2014, 12:43 PM
  4. Replies: 3
    Last Post: 02-07-2013, 09:53 PM
  5. Replies: 1
    Last Post: 05-24-2012, 04:59 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