Results 1 to 4 of 4
  1. #1
    achammar is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jul 2019
    Posts
    48

    Textbox on form not calculating

    Hi All!



    So I have 3 textboxes on a form. 2 of them have values (they actually get their values from 2 different subforms), and the 3rd text box adds the 2 together. These textboxes do not have a control source in any table or query. They just perform a calculation. I don't need it saved in a table. So when I fill out my subforms, those first 2 textboxes fill, and the 3rd one shows the sum of the 2. My problem is that if I don't fill out both subforms so that both textboxes have a value, the total textbox is blank. I want it to show the total of the other 2 textboxes even if only 1 has a value. I tried setting the default value to the textboxes to 0, but that doesn't work. I don't think a calculated control can have a default value maybe.

    Anyone have a solution?


    Thank you!!

    Albert

  2. #2
    davegri's Avatar
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,740
    Try
    =nz(TextBox1,0) + nz(textbox2,0)

  3. #3
    achammar is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jul 2019
    Posts
    48
    That fixed it! Thank you so much davegri!

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

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

Similar Threads

  1. Replies: 7
    Last Post: 02-24-2020, 03:22 PM
  2. Replies: 5
    Last Post: 02-04-2017, 07:34 AM
  3. Replies: 6
    Last Post: 02-26-2016, 05:28 AM
  4. Replies: 2
    Last Post: 12-22-2015, 09:09 PM
  5. Replies: 5
    Last Post: 04-30-2015, 01:50 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