Microsoft KB Archive/94260

= Pmt# Causes Illegal Function Call Error If No Math Coprocessor =

PSS ID Number: 94260

Article Last Modified on 1/8/2003

-

The information in this article applies to:


 * Microsoft Visual Basic for MS-DOS 1.0

-



This article was previously published under Q94260



SYMPTOMS
If you use the Pmt# function from the Financial Toolkit in Microsoft Visual Basic version 1.0 for MS-DOS, and you do not have either an 80387 math coprocessor enabled or an 80486 computer, you will receive the following incorrect error message:

Illegal function call

This also occurs when you use the FV, NPer, PPmt, PV, or Rate financial functions.



WORKAROUND
To work around the problem, you can use the function Payment defined in the example shown below in the More Information section.



STATUS
Microsoft has confirmed this to be a bug in Microsoft Visual Basic version 1.0 for MS-DOS with the source code for the Financial Toolkit Library function Pmt#. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.



MORE INFORMATION
To work around the problem, you can use the Payment function as defined in the following example: ' Sample PMT replacement ' Sample code only. No warranty is implied. ' Enter the following DECLARE on one, single line: DECLARE FUNCTION Payment (Rate#, Npers#, PV#, FV#, EndBegin%, Status%) AS DOUBLE

DIM CarPayment AS SINGLE DIM Status AS INTEGER DIM AnnualRate AS DOUBLE DIM PeriodicRate AS DOUBLE DIM Periods AS DOUBLE DIM PresentValue AS DOUBLE

AnnualRate = .14              ' 14% PeriodicRate = AnnualRate / 12 Periods = 60                  ' Months PresentValue = 12000          ' dollars

CarPayment = Payment(PeriodicRate, Periods, PresentValue, 0, 0, Status)

IF Status = 1 THEN PRINT &quot;Error, payment not calculated&quot; ELSE PRINT CarPayment END IF

FUNCTION Payment (Rate#, Npers#, PV#, FV#, EndBegin%, Status%) AS DOUBLE ' End of Period and Future Value calculations are not supported

DIM AnnuityFactor AS DOUBLE

IF EndBegin% <> 0 OR FV# <> 0 THEN ' End or Period or FV calculation requested. Status% = 1 ' error Payment = 0 ELSE AnnuityFactor = (1 / Rate#) - 1 / (Rate# * (1 + Rate#) ^ Npers#) Payment = PV# / AnnuityFactor Status% = 0 ' ok   END IF END FUNCTION

Additional query words: VBmsdos buglist1.00 1.00 FINANCE.LIB finance illegal function

Keywords: KB94260

Technology: kbAudDeveloper kbVB100DOS kbVBSearch kbZNotKeyword3

-

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

© 2004 Microsoft Corporation. All rights reserved.