[mso] Error when trying to calculate a total on a Word form

  • From: "Diane Rainaud" <drainaud@xxxxxxx>
  • To: "MSO @ Freelists. Org (E-mail)" <mso@xxxxxxxxxxxxx>
  • Date: Mon, 20 Jan 2003 21:54:51 -0500

In the following 2 sub routines (calcSub and calcTot) calcSub works but
calTot gives me this error:

Run-time error '-2147467259 (80004005)':
Method 'Result' of object "FormField' failed

Can anyone give me some idea of what I've done wrong?

Thanks for any help.

Diane
-------------------------------------------------------
Sub calcSub()

    Dim CurSub As Currency
    Dim curRate1 As Single
    Dim curRate2 As Single
    Dim curRate3 As Single
    Dim curRate4 As Single
    Dim curRate5 As Single
    Dim curRate6 As Single
    Dim curRate7 As Single
    Dim curRate8 As Single

    If IsNumeric(ActiveDocument.FormFields("txtRate1").Result) Then
        curRate1 = ActiveDocument.FormFields("txtRate1").Result
    Else
        curRate1 = 0
    End If
    If IsNumeric(ActiveDocument.FormFields("txtRate2").Result) Then
        curRate2 = ActiveDocument.FormFields("txtRate2").Result
    Else
        curRate2 = 0
    End If
    If IsNumeric(ActiveDocument.FormFields("txtRate3").Result) Then
        curRate3 = ActiveDocument.FormFields("txtRate3").Result
    Else
        curRate3 = 0
    End If
    If IsNumeric(ActiveDocument.FormFields("txtRate4").Result) Then
        curRate4 = ActiveDocument.FormFields("txtRate4").Result
    Else
        curRate4 = 0
    End If
    If IsNumeric(ActiveDocument.FormFields("txtRate5").Result) Then
        curRate5 = ActiveDocument.FormFields("txtRate5").Result
    Else
        curRate5 = 0
    End If
    If IsNumeric(ActiveDocument.FormFields("txtRate6").Result) Then
        curRate6 = ActiveDocument.FormFields("txtRate6").Result
    Else
        curRate6 = 0
    End If
    If IsNumeric(ActiveDocument.FormFields("txtRate7").Result) Then
        curRate7 = ActiveDocument.FormFields("txtRate7").Result
    Else
        curRate7 = 0
    End If
    If IsNumeric(ActiveDocument.FormFields("txtRate8").Result) Then
        curRate8 = ActiveDocument.FormFields("txtRate8").Result
    Else
        curRate8 = 0
    End If

    CurSub = curRate1 + curRate2 + curRate3 + curRate4 + curRate5 + curRate6
+ curRate7 + curRate8
    ActiveDocument.FormFields("txtSubTotal").Result = CurSub

End Sub
----------------------------------------------------------------------------
-------------------
Sub CalcTot()
Dim TaxAmt As Single
Dim CurSub2 As Single
Dim CurTot As Single

If IsNumeric(ActiveDocument.FormFields("txtSubTotal").Result) Then
    CurSub2 = ActiveDocument.FormFields("txtSubTotal").Result
Else
    CurSub2 = 0
End If

If IsNumeric(ActiveDocument.FormFields("txtTaxes").Result) Then
    TaxAmt = ActiveDocument.FormFields("txtTaxes").Result
Else
    TaxAmt = 0
End If

CurTot = CurSub2 + TaxAmt
ActiveDocument.FormFields("txtTotal").Result = CurTot


End Sub

*************************************************************
You are receiving this mail because you subscribed to mso@xxxxxxxxxxxxx or 
MicrosoftOffice@xxxxxxxxxxxxxxxx

To send mail to the group, simply address it to mso@xxxxxxxxxxxxx

To Unsubscribe from this group, send an email to 
mso-request@xxxxxxxxxxxxx?Subject=unsubscribe

Or, visit the group's homepage and use the dropdown menu.  This will also allow 
you to change your email settings to digest or vacation (no mail).
//www.freelists.org/webpage/mso

To be able to use the files section for sharing files with the group, send a 
request to mso-moderators@xxxxxxxxxxxxx and you will be sent an invitation with 
instructions.  Once you are a member of the files group, you can go here to 
upload/download files:
http://www.smartgroups.com/vault/msofiles
*************************************************************

Other related posts:

  • » [mso] Error when trying to calculate a total on a Word form