Results 1 to 10 of 10
  1. #1
    adeebarsad is offline Novice
    Windows 10 Access 2016
    Join Date
    Mar 2017
    Posts
    15

    Sum in unbound textbox

    Hi!
    I have a form called Form1 with many *bound textboxes I simply need to sum. I've changed the format to general number both in table and in field properties but the result is still in string. I've put this in the source code: =([Text0]+[Text1]+[Text2]+[Text3]+[Text4]+[Text5]+[Text6]+[Text7]+[Text8]+[Text9])
    Click image for larger version. 

Name:	hcl.JPG 
Views:	17 
Size:	26.3 KB 
ID:	27929

    The result should've been 3 instead of 0100001001. Anyone knows what's the problem here? I've tried subtracting and others but it works okay.

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,420
    you said the controls are unbound, but then say you have changed the format in the table and field properties. It can only be one or the other. The other point is that formatting does not change the underlying datatype - which needs to be numeric.

  3. #3
    adeebarsad is offline Novice
    Windows 10 Access 2016
    Join Date
    Mar 2017
    Posts
    15
    Its bound, my mistake

  4. #4
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,410
    What's the recordsource for form1? If it's a table, what's the table structure, a query, what's the query string.
    I've tried subtracting and others but it works okay.
    Can you expand on this?

  5. #5
    adeebarsad is offline Novice
    Windows 10 Access 2016
    Join Date
    Mar 2017
    Posts
    15
    It's a table
    Click image for larger version. 

Name:	Table1.JPG 
Views:	14 
Size:	29.2 KB 
ID:	27945

  6. #6
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,410
    You'll need to use the SUM function in a totals query.
    SUM works vertically in a column of records.
    How did you decide to include only 10 rows in the table?
    What is the data property for the Na2CO3 fields?
    What is the purpose of the comboboxes? Do they have anything to do with what's in the Na2CO3 textboxes next to them?
    Last edited by davegri; 03-21-2017 at 09:53 PM. Reason: more questions

  7. #7
    adeebarsad is offline Novice
    Windows 10 Access 2016
    Join Date
    Mar 2017
    Posts
    15
    The SUM only works if I want to sum all of the Na2CO3 field. I only want to choose some of it. The combo box is the list containing all the test ID I want to choose from Table1 and the Na2CO3 textbox next to it is the result of choosing from the test ID combo box.

  8. #8
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,410
    I'm unable to duplicate your problem with a test setup. You'll need to upload your DB so that we can see it.

  9. #9
    adeebarsad is offline Novice
    Windows 10 Access 2016
    Join Date
    Mar 2017
    Posts
    15
    Here you go
    Attached Files Attached Files

  10. #10
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,410
    =Val([Text0])+Val([Text1])+Val([Text2])+Val([Text3])+Val([Text4])+Val([Text5])+Val([Text6])+Val([Text7])+Val([Text8])+Val([Text9])

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

Similar Threads

  1. unbound textbox to bound textbox
    By thescottsman92 in forum Access
    Replies: 3
    Last Post: 08-29-2013, 02:02 AM
  2. Replies: 4
    Last Post: 05-31-2013, 07:00 PM
  3. Replies: 8
    Last Post: 04-12-2013, 08:59 PM
  4. Unbound, form textbox populated
    By WiReLaD in forum Access
    Replies: 7
    Last Post: 11-19-2012, 12:54 PM
  5. Unbound textbox and report linked to vba
    By Shambler2 in forum Programming
    Replies: 7
    Last Post: 06-09-2011, 04:29 PM

Tags for this Thread

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