How JustAnswer Works:

  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.

Ask Greg Maxey Your Own Question

Greg Maxey
Greg Maxey, Consultant\Microsoft Word Expert
Category: General
Satisfied Customers: 62
Experience:  Microsoft Word Most Valuable Professional (6 years)
16468162
Type Your Question Here...
Greg Maxey is online now
A new question is answered every 9 seconds

Ask a Microsoft Word Question Ive created a form including

Resolved Question:

Ask a Microsoft Word Question
>I've created a form including monetary calculations, using formfields.

I need all fields to remain blank until the user has filled them in or they show the end result of a calculation based on the user's entry. Currently, an otherwise blank form has several result fields that show $0.00. I don't mind the dollar symbol, but the actual numerals are a problem in case the user needs to print the form and fill it out, rather than filling it out online.
Submitted: 5 years ago.
Category: General
Expert:  Greg Maxey replied 5 years ago.

My name isXXXXX and I am a certified Microsoft Word Expert affiliated with JustAnswers. Thank you for giving me the opportunity to assist you with your Word question.

 

Based on the way numerical fields and calculation fields work one option (if you want to remain with formfields) is to use formatted numerical fields for your variables using the following numerical format and leave the defualt numbe field blank:

 

$#,##0.00;($#,##0.00);

 

and use a plain text field (with fill in enabled unchecked) for the result. You would need to assign the following macro to run on exit from your variable field.

Sub SumOnExit()

Dim lngA As Long, lngB As Long, lngResult As Long

On Error Resume Next

lngA = CLng(ActiveDocument.FormFields("Text1").Result)

If Err.Number <> 0 Then lngA = 0

Err.Clear

lngB = CLng(ActiveDocument.FormFields("Text2").Result)

If Err.Number <> 0 Then lngB = 0

On Error GoTo 0

lngResult = lngA + lngB

ActiveDocument.FormFields("Text3").Result = FormatCurrency(lngResult)

If ActiveDocument.FormFields("Text1").Result = "" Then

ActiveDocument.FormFields("Text2").Result = ""

ActiveDocument.FormFields("Text3").Result = ""

End If

End Sub

 

As an alternative you could leave the form as it is and offer you users to the option to clear all fields including the zeros before printing using this procedure:

Sub ClearZeroes()
Dim oFF As FormField
For Each oFF In ActiveDocument.FormFields
oFF.Result = ""
Next
End Sub

 

For help installing and using this macro see: http://www.gmayor.com/installing_macro.htm

Greg Maxey and 42 other General Specialists are ready to help you