![]() |
|
|||||||
| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
| Questions & Help Needed Post any question regarding Basic4ppc. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Hi, this is my first post on this great site. I have started playing around with the desktop version and am trying to make a loan formula, but I must be getting the syntax wrong.
Here is what it's supposed to look like: Payment = (Rate + (Rate / ((1 + Rate) ^ Months) * -1)) * Principal For some reason when I enter it like that I get a syntax error. I believe that my use of negative one is the problem. I appreciate any help. Thanks! Steve |
|
||||
|
Heve you tried to do the math step by step so that you can pinpoint the trouble bit?
__________________
Paulo Gomes Porto, Portugal "The Past is nothing more than the constructions of a Present that was once called Future" Desktop PC: Currently NONE Mobile Device: QTEK S200, WinMo 6.5 Laptop: Toshiba NB100-130 DLL Version Listing |
|
||||
|
have you trried to wrap the negative one in parentesis as (-1)?
__________________
Paulo Gomes Porto, Portugal "The Past is nothing more than the constructions of a Present that was once called Future" Desktop PC: Currently NONE Mobile Device: QTEK S200, WinMo 6.5 Laptop: Toshiba NB100-130 DLL Version Listing |
|
||||
|
Trip the formula and use msgboxs to show the current result...
Some thing like this: Code:
Payment=(1 + RATE)* (-1) 'This should be the critic part, if you can pass this then all ok... MSGBOX(payment) Payment=(Payment+Rate) 'I don't know how you are implemeting the rate...But you should not introduce a percentage in a direct calculation... MSGBOX(payment) Payment = Payment * Principal Rate SHOULD not be in percentage, but represent the ratio...
__________________
Paulo Gomes Porto, Portugal "The Past is nothing more than the constructions of a Present that was once called Future" Desktop PC: Currently NONE Mobile Device: QTEK S200, WinMo 6.5 Laptop: Toshiba NB100-130 DLL Version Listing |
|
|||
|
I figured it out. I made an error. I was supposed to subtract 1, not multiply by negative one. Here's my final code:
Sub cmdCalc_Click Dim Prin Dim Rate Dim Term Dim MonthlyRate Dim Payment Dim Middle Dim bottom Prin = txtPrin.Text Rate = txtRate.Text / 1200 Term = txtLength.Text * 12 bottom = ((1 + Rate) ^ (Term )) bottom = bottom - 1 middle = Rate / bottom Payment = (Rate + middle) * Prin lblOut.Text = Payment Thanks for the help. |
|
||||
|
Quote:
You can just use the without previous settings... If you need to share a variable bettween several subs, then put them in the Global sub, like this: Prin="" Rate="" Term="" MonthlyRate="" Payment="" Middle="" bottom=""
__________________
Paulo Gomes Porto, Portugal "The Past is nothing more than the constructions of a Present that was once called Future" Desktop PC: Currently NONE Mobile Device: QTEK S200, WinMo 6.5 Laptop: Toshiba NB100-130 DLL Version Listing |
|
||||
|
Glad to ear that, and always glad to help...
__________________
Paulo Gomes Porto, Portugal "The Past is nothing more than the constructions of a Present that was once called Future" Desktop PC: Currently NONE Mobile Device: QTEK S200, WinMo 6.5 Laptop: Toshiba NB100-130 DLL Version Listing |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| SQLite newbie question | JamesC | Chit Chat | 1 | 08-01-2008 08:26 AM |
| SQLite external library newbie question | JamesC | Questions & Help Needed | 2 | 05-29-2008 03:48 AM |
| Newbie question - arrays and tables | BjornF | Questions & Help Needed | 3 | 05-15-2008 09:29 AM |
| Another newbie question: How to refere to the active form? | yildi | Questions & Help Needed | 2 | 11-17-2007 07:55 PM |
| Newbie - question about loadXML | yildi | Questions & Help Needed | 6 | 11-12-2007 11:43 PM |