Home > Archive > Visual Basic Controls > January 2005 > Runtime Error 5 - Invalid Procedure call or argument
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Runtime Error 5 - Invalid Procedure call or argument
|
|
|
| I have an VB6 application that I wrote about 1 year ago. The application
worked great until recently. All of a sudden the application has been
generating the above error. The error points to the NPer function. I did
not write this function it is part of the VB6 library of Financial functions.
As I said before, the application worked flawlessly for months and it is
only now that I am experiencing this problem.
Does anyone have a clue as to what happened?
Please help.
Thanks
Frank
| |
| alpine 2005-01-23, 9:01 pm |
| On Thu, 20 Jan 2005 11:43:02 -0800, "Frank"
<Frank@discussions.microsoft.com> wrote:
>I have an VB6 application that I wrote about 1 year ago. The application
>worked great until recently. All of a sudden the application has been
>generating the above error. The error points to the NPer function. I did
>not write this function it is part of the VB6 library of Financial functions.
> As I said before, the application worked flawlessly for months and it is
>only now that I am experiencing this problem.
>
>Does anyone have a clue as to what happened?
>
>Please help.
>
>Thanks
>Frank
What is the value you are passing in the call? Is it within the
expected range of values for that call?
HTH,
Bryan
________________________________________
____________________
New Vision Software "When the going gets weird,"
Bryan Stafford "the weird turn pro."
alpine_don'tsendspam@mvps.org Hunter S. Thompson -
Microsoft MVP-Visual Basic Fear and Loathing in LasVegas
| |
| Karl E. Peterson 2005-01-23, 9:01 pm |
| Frank wrote:
> I have an VB6 application that I wrote about 1 year ago. The
> application worked great until recently. All of a sudden the
> application has been generating the above error. The error points to
> the NPer function. I did not write this function it is part of the
> VB6 library of Financial functions. As I said before, the
> application worked flawlessly for months and it is only now that I am
> experiencing this problem.
>
> Does anyone have a clue as to what happened?
Sounds like your data changed? What are you passing to it, when it blows?
--
[Microsoft Basic: 1976-2001, RIP]
| |
|
| As far as I can tell, yes.
Here's the syntax -
NPer(rate, pmt, pv[, fv[, type]])
rate is required,
pmt is required,
pv is required,
the others are optional
here is what I have:
rate - nRate
pmt - nPayment
pv - Balance
d = NPer(nRate, -(nPayment), CDbl(Balance))
where nAPR=0.02
nPayment=55
Balance=3000
The values are intended to change all of the time.
It does not seem to matter what values I use.
Thanks for your help.
"alpine" wrote:
> On Thu, 20 Jan 2005 11:43:02 -0800, "Frank"
> <Frank@discussions.microsoft.com> wrote:
>
>
>
> What is the value you are passing in the call? Is it within the
> expected range of values for that call?
>
> HTH,
> Bryan
> ________________________________________
____________________
> New Vision Software "When the going gets weird,"
> Bryan Stafford "the weird turn pro."
> alpine_don'tsendspam@mvps.org Hunter S. Thompson -
> Microsoft MVP-Visual Basic Fear and Loathing in LasVegas
>
| |
|
| Here's what I am passing .
Here's the syntax -
NPer(rate, pmt, pv[, fv[, type]])
rate is required,
pmt is required,
pv is required,
the others are optional
here is what I have:
rate - nRate
pmt - nPayment
pv - Balance
d = NPer(nRate, -(nPayment), CDbl(Balance))
where nAPR=0.02
nPayment=55
Balance=3000
The values are intended to change all of the time.
It does not seem to matter what values I use.
"Karl E. Peterson" wrote:
> Frank wrote:
>
> Sounds like your data changed? What are you passing to it, when it blows?
> --
> [Microsoft Basic: 1976-2001, RIP]
>
>
>
| |
| Karl E. Peterson 2005-01-23, 9:01 pm |
| Well, I've never used this function before, but it appears to me (trial/error) that
the payment argument needs to be >= 0. Which, on the face of it, seems to make
sense. What's up with a negative payment?
--
[Microsoft Basic: 1976-2001, RIP]
Frank wrote:[color=darkred]
> Here's what I am passing .
>
> Here's the syntax -
> NPer(rate, pmt, pv[, fv[, type]])
>
> rate is required,
> pmt is required,
> pv is required,
> the others are optional
>
> here is what I have:
>
> rate - nRate
> pmt - nPayment
> pv - Balance
> d = NPer(nRate, -(nPayment), CDbl(Balance))
>
> where nAPR=0.02
> nPayment=55
> Balance=3000
>
> The values are intended to change all of the time.
> It does not seem to matter what values I use.
>
>
> "Karl E. Peterson" wrote:
>
--
[Microsoft Basic: 1976-2001, RIP]
| |
| Ken Halter 2005-01-23, 9:01 pm |
| "Frank" <Frank@discussions.microsoft.com> wrote in message
news:17DC7284-4693-41A2-AC4C-81C7DB19A0CA@microsoft.com...
> rate - nRate
> pmt - nPayment
> pv - Balance
> d = NPer(nRate, -(nPayment), CDbl(Balance))
How about breaking that line into 2 lines until you've debugged
everything... something like:
b = CDbl(Balance)
d = NPer(nRate, -(nPayment), b)
At least you'll know if CDbl was the culprit.... of course, that would
(should) raise an error 13, not error 5... unless Balance is a function
itself... in that case, the error may've been raised in the Balance
function. (can you tell that we need more details? <g> Variable
declarations could help a bunch)
Bottom line though.... if you're using nested function calls and you get an
error, it can get pretty tricky to figure out which function raised the
error (if there's no error traps in place) so break up the nested calls
until everything's sorted out.
--
Ken Halter - MS-MVP-VB - http://www.vbsight.com
Please keep all discussions in the groups..
|
|
|
|
|