Microsoft KB Archive/99922

{| = BUG: Negative Numbers in Report Writer Don't Display Properly =
 * width="100%"|

ID: Q99922

The information in this article applies to:


 * Microsoft FoxPro for MS-DOS, versions 2.0, 2.5, 2.5a
 * Microsoft FoxPro for Windows, versions 2.5, 2.5a

SYMPTOMS
In the Report Writer, if the (Negative) option (under the Format options for a field) is selected, you must enter a format string for the field or variable in the Format input box in order for the contents to be displayed correctly.

WORKAROUND
Specify the (Negative) option with a format string. For example, if a format string such as 999.99 is entered, the number -14.00 is displayed as:

(14.00) NOTE: The format string must be large enough to allow space for the content of the field or variable and the parentheses. In addition, the width of the field or variable must be large enough to display the content.

STATUS
Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

Using the Format Expression
If you format the number field using a format expression, such as (999,9999.99), the minus sign appears within the parentheses. If you don't want the minus sign inside the parentheses, use the IIF formula. It will ensure that negative values are printed inside parenthese without minus signs.

For example, use the following IIF expression if you want to print the value of a variable (x) that may have a negative value (-123.45 in this example):

NOTE: Although it has to be wrapped to fit into this article, the code for the IIF function listed below should be typed as one continuous line in the Report Writer. Do not attempt to use the semicolon as a line continuation character in the Report Writer.

x=-123.45

IIF(x<0, &quot;(&quot;+RIGHT(STR(x,13,2), LEN(ALLTRIM(STR(x)))+2)+&quot;)&quot;,  ALLTRIM(STR(x,13,2))) This IIF expression yields: (123.45)

Steps to Reproduce Problem
Specifying the (Negative) option without a format string causes the contents of the field or variable to be displayed improperly. For example, the number -14.00 is displayed as:

(   14.0 Additional reference words: FoxDos FoxWin RWriter 2.00 2.50 2.50a buglist2.00 buglist2.50 buglist2.50a truncation trunk shorten cut off KBCategory: kbtool kbprg kbbuglist KBSubcategory: FxtoolRwriter
 * }