• #Error value in Sum Field from Sub Form

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » #Error value in Sum Field from Sub Form

    Author
    Topic
    #464172

    My [MainForm] has [SubForm1] that has the following summed field hidden in the footer: =Sum([Cost])

    I am pulling this value up to the [MainForm] via: =(SubForm1].[Form]![SumCost]) This field is a “currency” field.

    The value transfers fine until I have a record with no underlying records. In essence, there is not always a related record in my subform – some main records do not require use of a related ‘subrecord’. In these instances, I get a the dreaded #Error value displayed. I understand why I am getting it, because there is no related subrecords. I have tried to use the Nz value but I know this is not correct, since there is no value of “0”.

    Is there some other method of tricking the system show the #Error message does not display? I tried to setting the default value in the field to 0, but that did not work either.

    Thanks in advance for any assistance.

    Viewing 1 reply thread
    Author
    Replies
    • #1187230

      Use the following formula :
      =IIf(IsError([SubForm1].[Form]![SumCost]),0, [SubForm1].[Form]![SumCost])

    • #1187249

      Thanks Francis. I never considered the IsError operator for this issue.

    Viewing 1 reply thread
    Reply To: #Error value in Sum Field from Sub Form

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: