Share via

#Size! and #Type! textbox errors

Anonymous
2016-11-02T05:27:05+00:00

Hello,

I have  textboxes with calculations and I am getting both of these errors. I can't seem to figure out why.

this is the data inside my textboxes

txttotalpayment = [SubFrmContractPayment].[Form]![txtPaymentTotal] This textbox displays correctly

txtcontractbal=[contractamount]-[txttotalpayment]-[txtretention] This textbox displays #Type!

txtcontractbal = Nz([contractamount])-Nz([txttotalpayment])-Nz([txtretention]) This textbox displays #Size! when I add NZ

txtretention =Nz([txttotalpayment])/(1-Nz([contractretention]))-Nz([txtcontractbal]) This textbox displays #Size!

Your help would be greatly appreciated!

Thank you

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2016-11-05T16:55:02+00:00

As I said you are referencing text box names rather than fields. 

You need to repeat the calculation like this --

Instead of using -- txtcontractbal=[contractamount]-[txttotalpayment]-[txtretention]

  use  -- txtcontractbal=[contractamount] - ([SubFrmContractPayment].[Form]![txtPaymentTotal]) - [txtretention]

Do the same for the others.

Was this answer helpful?

0 comments No comments

6 additional answers

Sort by: Most helpful
  1. Anonymous
    2016-11-02T21:35:47+00:00

    this is the data inside my textboxes

    txttotalpayment = [SubFrmContractPayment].[Form]![txtPaymentTotal]

    txtcontractbal=[contractamount]-[txttotalpayment]-[txtretention]

    txtcontractbal = Nz([contractamount])-Nz([txttotalpayment])-Nz([txtretention])

    txtretention =Nz([txttotalpayment])/(1-Nz([contractretention]))-Nz([txtcontractbal]) 

    Is the BOLD the names of the text boxes?  If so then you are referencing text box names rather than fields -- that want work without doing a complete reference to include the name of the form where the text box is located.

    Was this answer helpful?

    0 comments No comments
  2. Duane Hookom 26,825 Reputation points Volunteer Moderator
    2016-11-02T17:49:43+00:00

    You should be able to combine more than two references to other controls into the control source of another control. I would make sure the names are correct and you handle nulls correctly.

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2016-11-02T16:01:11+00:00

    I tried it with no success. I am assuming the textbox doesn't accept more than 2 other fields in the calculation. I tried adding only two fields at a time and it worked. The only thing is that I have to create more textboxes to come up with the expected result.

    for example:

    txtcontractbal1=Val([contractamount])-Val([txttotalpayment])

    txtcontractbal2 = Val([txtcontractbal1])-Val([txtretention])

    That is the only way it worked, but if you know of a simpler way to do it please let me know!

    Thank you :)

    Was this answer helpful?

    0 comments No comments
  4. Duane Hookom 26,825 Reputation points Volunteer Moderator
    2016-11-02T07:30:42+00:00

    I never use Nz() without specifying the default value.

      Nz([contractamount],0)

    Is it possible you are dividing by zero?

    Try:

    txtcontractbal=Val([contractamount])-Val([txttotalpayment])-Val([txtretention])

    Was this answer helpful?

    0 comments No comments