Microsoft KB Archive/290426

= PRB: Round Function Does Not Accept Negative Parameters =

Article ID: 290426

Article Last Modified on 6/25/2004

-

APPLIES TO


 * Microsoft Visual Basic 6.0 Enterprise Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition Service Pack 3
 * Microsoft Visual Basic 6.0 Enterprise Edition Service Pack 4
 * Microsoft Visual Basic 6.0 Enterprise Edition Service Pack 5
 * Microsoft Visual Basic 6.0 Professional Edition

-



This article was previously published under Q290426



SYMPTOMS
If you use a negative number for the second parameter of the Round function, the function returns the following error message:

Runtime Error 5: Invalid procedure call or argument.



CAUSE
The Round function does not accept negative numbers for the second parameter. The second parameter indicates the number of decimal places that should be returned. By design, the expression service calls Visual Basic for Applications (VBA) to evaluate Round.



Steps to Reproduce Behavior
 Open a project in Visual Basic 6.0.  Paste the following code into the Immediate window: Debug.Print Round(2.45, 1) 'returns 2.4. Debug.Print Round(2.45, -1) 'returns the error  Press ENTER after each line to see the evaluation of the function. The second line, which contains the negative number, returns the above-mentioned error message.

Additional query words: run-time

Keywords: kbdatabase kbjet kbprb KB290426

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.