Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  HOME    TRACKER    Visual Basic

Compound Interest

i am working on a simple bank project in which we r having module in which we have to calcaulate the compound interest. the problem is like thisno. of. months, rate of interest and totals amounts are the inputs. the interest should be calculated for every quarter and the resultant should be added to balance and for the next quarter the interest should be calculated on the entire balance amount. and it should also calculate the interst for the days also and the interest should be cumulated to nearest quarter balnace.pleae provide me the logical solution. for this.

View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Compound Interest Calculation Problem
I am very new to Visual Basic, I need help getting the "Calculate Earnings" to be calculate correctly.

Also in the attached screenshots I need the calculation to appear in the 3 bottom text boxes.

I made a couple messages boxes that are doing fine and serving their purpose so they are doing okay.

Thanks for any help you can provide.


VB: Compound Interest Extras Program
I'm doing a compound interest program... I have the main part of it done... enter in an amount and interest rate (annually)... I need it to spit out the amount of time in years it will take to double the money and the amount of time in years to reach a million dollars.... any ideas???

I have the picture boxes and everything laid out... amount and interest rate are labels... and then 2 seperate txt boxes... click button to determine years.... and then doubling time is a label and reach a million is a label.... both doubling time and reach a million are done in picture boxes


Compound Key Using DAO?
Hey, how can I make a compound key for a relational database using DAO in VB6? It wont let me append more than one key per table... is it possible?

Thanks in advance

"To the pressure, everything's just like: an illusion. I'll be losing you before long..."

Compound With Statement?
Is it possible to do a compound With statement? I don't think there is a way, but I could be wrong.
For example:

With Form1
With Form2
.this = .that ' Where .this is from Form1 and .that is from Form2
End With
End With
Like I said, the above definitely won't work, but is there a way to make it work? Thanks in advance!

SQL: Compound Statements
What is the proper syntax to combine the two including the variables?
Is 'AND' even valid SQL syntax?

public Item as long
public Oper as integer

Public Const SQL_readMatl1 As String = "SELECT * FROM [MATL] Where [Item] = "
Public Const SQL_readMatl2 As String = " AND [Oper_num] = "

Compound If Block

This is the code I am tackling:

Private Sub Text428_Click()
If (Option390 = "1" And Option396 = "1") Then
Me.Text428 = (Val(Me.sbwt.Value) / (Val(Me.sbht.Value) * Val(Me.sbht.Value))) * 703
ElseIf (Option392 = "2" And Option398 = "2") Then
Me.Text428 = Val(Me.sbwt.Value) / ((Val(Me.sbht.Value) / 100) * (Val(Me.sbht.Value) / 100))
End If
End Sub

Basically it's calculating Body Mass Index which consists of height (sbht) and weight (sbwt), each of which can be given in either of two units (Height unit can either be Option390 or Option392; Weight unit can either be Option396 or Option398). Text428 is the field of the BMI value

When I try to run the action (i.e. click Text428 on the form), I get the following error:

Run-time error '2427':
You entered an expression that has no value

And the line that's highlighted above in the code is pointed out.

Any insight?

Compound Query Using ADO
I have updated a VB6 program to utilize ADO instead of DAO and am now getting no records returned on the following query. The query worked fine using DAO. Any ideas?

Code:Private Function GetRecords(Optional ByVal strSelectCriteria As String) As Boolean
   If strSelectCriteria = "" Then
      qryTimeSheet = "SELECT * FROM TimeSheet "
      qryTimeSheet = "SELECT " & strSelectCriteria & " FROM TimeSheet "
   End If
   With udtReportCriteria
      If .strFilterQuery <> "" Then
         If .strTeamSelectionQuery <> "" Then
            qryTimeSheet = qryTimeSheet _
                              & "WHERE (" & .strDateSelectionQuery & " AND " _
                              & "UserID IN " _
                              & "(SELECT MainframeUserID FROM UserNames " _
                              & "WHERE " & .strTeamSelectionQuery & " AND " _
                              & .strFilterQuery & " AND " _
                              & "(Gone = " & False & "))) " _
                              & "ORDER BY " & .strOrderBy & ";"
            qryTimeSheet = qryTimeSheet _
                              & "WHERE ((" & .strDateSelectionQuery & ") AND " _
                              & .strFilterQuery & " AND " _
                              & "(UserID = '" & udtUserInfo.strUserID & "')) " _
                              & "ORDER BY " & .strOrderBy & ";"
         End If
         If .strTeamSelectionQuery <> "" Then
            qryTimeSheet = qryTimeSheet _
                              & "WHERE (" & .strDateSelectionQuery & " AND " _
                              & "UserID IN " _
                              & "(SELECT MainframeUserID FROM UserNames " _
                              & "WHERE " & .strTeamSelectionQuery & " AND " _
                              & "(Gone = " & False & "))) " _
                              & "ORDER BY " & .strOrderBy & ";"
            qryTimeSheet = qryTimeSheet _
                              & "WHERE ((" & .strDateSelectionQuery & ") AND " _
                              & "(UserID = '" & udtUserInfo.strUserID & "')) " _
                              & "ORDER BY " & .strOrderBy & ";"
         End If
      End If
   End With
   Set rstTimeSheet = New ADODB.Recordset
   With rstTimeSheet
      .Open qryTimeSheet, connTimeTracker, adOpenStatic, adLockReadOnly, adCmdText
      longUpperBound = .RecordCount
   End With
   GetRecords = (longUpperBound > 0)
End Function

Edited by - Shandy on 4/19/2004 9:24:14 AM

Compound Selection Problem

This code won't execute:

Sub select()

ref = [A53].Value

Sheets(ref & " something").Select

I get this error message: "Run-time error 1004: Select method of Worksheet class failed".

This sub used to be OK and now I can't get it to execute anymore!

Is it a bug or did I miss something?

It happened several times while I was developping that sheet that a sub didn't work... Then I had to fragment the code into several lines, the sub executed and then it was possible to rewrite the single-line code and get it to work. Did this happened to anyone too?

Precision: I just checked it and everything just does work in step into mode!!!

Thank you for any suggestion!

Compound, Sequential, MD5 Hashes
I have a question about MD5 hashes. Given that it's relatively simple and quick to hash a string as short as a password file, I had an idea. Since you can hash the hash of the password, can't you hash the output, say, 10 times sequentially to make it uber-secure? To find the text that was hashed, you would have to bruteforce it. Wouldn't you then have to do 10 sequential bruteforces to find the original text? Also, I think it's theoretically possible to have two strings or bits of information that hash to the exact same thing, right? Then, if it were bruteforced 10 times, there would be 10 times the probablility of finding a string that works, but wasn't the original one?

These questions are very hypothetical, I know it takes a lot of time and an extreme amount of computing power to go through all the combinations.

Thanks for reading this , I know it's pretty long.

Problems With Compound SQL Request VB6 Jet 4
I am working on an application where the user gets to select the starting date to view all the expenses charged for selling and buying investments. (broker fees)
Here is the code I have writen. I want to return all the purchase fees from the table "Holdings" as of and beyond the date selected from a list box. Also I want to return all the records relating to the sales fees, same criteria.

adoSumFees.RecordSource = "SELECT * FROM Holdings WHERE (Purchase_Date) >= # " & frmDataReports.lstDate & " # AND (Broker_Fee_Buy) > 0 OR (Sold_Date) >= # " & frmDataReports.lstDate & " # AND (Broker_Fee_Sell) > 0 AND (Investor_Number) = " & frmDataReports.txtInvestorID

The quirky thing in this is when I run this code I don't get errors but it returns all records for expenses dispite the fact that I ask for only a specific "Investor ID". I know it is getting the Investor ID number okay because when I shorten up the request to ask for just Purchase expenses and purchase dates, the data comes back fine. IE all expenses from the date selected and for the selected Investor ID. ????

Likewise if I request just the sales date and the sales costs I get a correct return, but when I combine them as in the code shown above, it seems to ignor the Investor ID filter and every investor's costs are returned.

Just a small note about the records in the table "Holdings". The data for purchasing, buying fees, purchase dates are in seperate records than the selling. I needed to do it that way becuse the Investor may want to buy or sell a perticular investment several times. Creating seperate records for each purchase but linking them together with a field called Investment_Number allwed me to give the user that option.
I hope I have been able to give you all the information you need to help without boring you with all this writting. lol!

I have tired every combination of ANDs and ORs, brackets and quotation marks for the past two days. I need help.

Dwight Kehoe

Compound SumIf() Conditional Formula
I'm looking for what would be the equivelant to a compound SumIf() function that can be used in a formula.

For example:

The cells in a given Range (ie; E4:E25) can contain 1 of 3 different code values... "AB", "BW", and "RW"

The cells in a given Range (ie; G4:G25) can contain 1 of 4 different code values... "E5050NSTD", "F5050NSTD", "G5050NSTD", and "H5050NSTD"

The cells in another Range (ie; H4:H25) contain a numeric value.

If I wanted to calculate the sum of values from the Range H4:H25, whose corresponding E cells contained "AB", then I'd use the formula:


Likewise, if I wanted to calculate the sum of values from the Range H4:H25, whose corresponding G cells contained "F5050NSTD", then I'd use the formula:


What I am having difficulty with, is creating a formula that would take two conditions to produce the sum of values from H4:H25.

In psuedo-code:

=SUMIF(E4:E25="AB" AND G4:G25="F5050NSTD",H4:H25)


Validating A Date In A Compound IF Statement
I need to validate a date entered into a textbox in the form mm/dd/yy by using a massive compound IF statement. If the date is valid, nothing happens but if an invalid date is entered, a message box pops up saying, "invalid date."

this is what I have so far:

fulldate= txtdate.text
month = fulldate.Substring(0, 2)
day = fulldate.Substring(3, 2)
year = fulldate.Substring(6, 2)

If (month < 1 Or month > 12) Or (day < 1 Or day > 31) Or (year > 3 And year < 38) Or (month = 4 And day > 30) Or (month = 6 And day > 30) Or (month = 9 And day > 30) Or (month = 11 And day > 30) Then
MsgBox("Invalid Date Entered", , "Data Entry Error")
Exit Sub
End If
I've tried a lot of different things to do the leapyear and non leapyear calculations but nothing works.

ADODB Compound Recordset Updation.
I have a ADODC, where recordset is containing the composite query on two tables bound with Apex TrueDBGrid. When i inset a new record in grid and try to update recordset it fires error as : child tables's reference is violated. There is reference between these two tables. So i need to update first parent table and then child table.
I found Unique Table in MSDN which allows updation and insertion operation only on one table if i wish but how to use this Unique Table i don't know. please guide for same

Vivek ( or

How To Use Structured Storage (compound Files)
Hi there,

I have browsed through my MSDN, looked into and several

vb-related sites, but I haven't found any sample of how to use

IPersistStream and the other interfaces concerning structured storage files

(sometimes refered to as ole compound files) with VB. What I'm looking for

is a kind of "translation" of the samples from chapters 7 and 8 from

Brockschmidt's "Inside OLE" into VB.

Can anyone help?



Ole2.0 Compound File Functions/docfile API
I want to use docFile API to introspect data in a MS-Word 97 document. Can I do it using docFile API. If yes, how do I do it. Is there any alternative to docfile API besides Word Object Library (which does not fit my requirements of encapsulating/introspecting the WHOLE of MS-Word 97 document).

Thanks in Advance,


Out Of Interest
Just out of interest.

Is there any differance between these statements?

if x = Chr(69) thenORif x = "E" then

Is one quicker or more correct than the other?

Interest Calculator
I need help, I am not sure where to plug-in the values that my teacher gave me for this problem. Here is the code that I have so far.

Option Explicit
Dim A As Double
Dim B As Double
Dim C As Double
Dim D As Double

Private Sub cmdcalc_Click()
A = Val(txtdep.Text)
B = Val(txtint.Text / 1200)
C = Val(txtmon.Text)
D = Val(txtbal.Text)

D = C * ((1 + B) ^ C - 1) / B
txtbal.Value = Format(D, "#######.00")
End Sub

Private Sub cmdclr_Click()
A = Empty
B = Empty
C = Empty
D = Empty
txtdep = ""
txtint = ""
txtmon = ""
txtbal = ""
End Sub

Private Sub cmdexit_Click()
End Sub

Private Sub UserForm_Click()

End Sub
The values that he wants up to plug-in are as follows.

note, you put in interest rate and the program divides by 1200, like below

intrate= interest (then number)/1200

say interest= 10

intrate= 10/1200

months = Log(finalvalue * intrate / deposit + 1) / Log(1 + intrate)

deposit = final / (((1 + intrate) ^ months - 1) / intrate)

final = deposit * ((1 + intrate) ^ months - 1) / intrate

as of right now, it doesn't matter what I put in for deposit, It only calculates the interest rate and the months. Any help would be appreciated.

Bank Interest
i need to create a program that will allow a user to enter amount after 5,10,15,20,25,30 years have it be compounded with 10% interest every 365 days help plz

Calculating Interest
I am working on a program in which the user enters an amount of money in a textbox, selects a beginning and ending date using the datetimepicker, and then the program calculates the new amount based on an interest rate of 1% compounded monthly. The code I have written is as follows:

VB Code:
Public Class Form1     Private Sub cmdCompute_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdCompute.Click        Dim startdate        Dim enddate        Dim lngMonths As Long        Dim amount As Double          amount = txtInitialAmount.Text         startdate = DateStart.Value.ToShortDateString        enddate = DateEnd.Value.ToShortDateString        lngMonths = DateDiff("m", startdate, enddate)          lblResult.Text = amount * 1.01 * lngMonths     End SubEnd Class

Tthe number of months between the startdate and the enddate is given in lngMonths, but I need to somehow use that figure from lngMonths in the formula so that if, for example, the user selects 3 months the formula will be amount * 1.01*1.01*1.01.
I know what I need to do, but don't seem to be able to get there!! Any guidance would be appreciated.

Calculate Interest?
Greetings all,

I'm trying to get this to work properly, its to calculate profit and new account balance as u put the money in a bank for interest.

For example, if we have a balance of $1000 in our account and we wish to know how much we will have in the account after 3 months using an annual interest rate of 4.5% compounded monthly:

After first month: interest earned = $1000 * 4.5 / 100 / 12 = $3.75
new balance = $1000 + $3.75 = $1003.75
After second month: interest earned = $1003.75 * 4.5 / 100 / 12 = $3.76
new balance = $1003.75 + $3.76 = $1007.51
After third month: interest earned = $1007.51 * 4.5 / 100 / 12 = $3.78
new balance = $1007.51 + $3.78 = $1011.29
So, after 3 months we will have $1011.29 in our account and we will have earned $11.29.

My code is:

VB Code:
Private Sub cmdCalculate_Click()     'Proform calculations    txtProfit.Text = Val(txtAccountbalance.Text) * 4.5 / 100 / Val(txtDuration.Text)    txtNewbalance.Text = Val(txtProfit.Text) + Val(txtAccountbalance.Text)        'To correct values to 2 decimal places since it is money.    txtNewbalance.Text = Format(txtNewbalance.Text, "currency")    txtProfit.Text = Format(txtProfit.Text, "currency")    End Sub

it doesnt work really well.. could someone tell me wad code to write?

My screenshot is attached below:

Calculate Interest
i have some problems with this calculate interest. For example:if we have a balance of $1000 in our account and we wish to know how much we will have in the account after 3 months using an annual interest rate of 4.5% compounded monthly:

After first month: interest earned = $1000 * 4.5 / 100 / 12 = $3.75
new balance = $1000 + $3.75 = $1003.75
After second month: interest earned = $1003.75 * 4.5 / 100 / 12 = $3.76
new balance = $1003.75 + $3.76 = $1007.51
After third month: interest earned = $1007.51 * 4.5 / 100 / 12 = $3.78
new balance = $1007.51 + $3.78 = $1011.29
So, after 3 months we will have $1011.29 in our account and we will have earned $11.29.
Can you help me,plz.Thanks a lot

Calculating Interest
i have some problems with calculating interest. For example:if we have a balance of $1000 in our account and we wish to know how much we will have in the account after 3 months using an annual interest rate of 4.5% compounded monthly:

After first month: interest earned = $1000 * 4.5 / 100 / 12 = $3.75
new balance = $1000 + $3.75 = $1003.75
After second month: interest earned = $1003.75 * 4.5 / 100 / 12 = $3.76
new balance = $1003.75 + $3.76 = $1007.51
After third month: interest earned = $1007.51 * 4.5 / 100 / 12 = $3.78
new balance = $1007.51 + $3.78 = $1011.29
So, after 3 months we will have $1011.29 in our account and we will have earned $11.29.
Anyone can help me?Thanks a lot

Interest Calculator Help
I'm making an Interest Calculator for a comp prog class and I have everything done except a monthly Interest Rate. I need to display how much you would pay a month for x amount of years and x interest for x amount of dollars. My problem is my variable for monthly interest rate has a value of zero, which messes up all my monthly total payment.

Here is my code...

Private Sub chkMonthly_Click()

'Sends Monthly Payments to lstMonthlyPayments

intCounter = 1
curPrincipal = Val(txtAmount)

lstMonthlyDisplay.AddItem ("Month" & vbTab & "Amount Payed")
dblMthInterestRate = Val(txtInterest / (12 * 100))
intMonths = (intYears * 12)

curMonthlyPayment = curPrincipal * (dblMthInterestRate / (1 - (1 + dblMthInterestRate) ^ -intMonths))

txtMonthlyPayment = Format(curMonthlyPayment, "$######.00")
txtTotalInterest = (dblMthInterestRate * intMonths)
dblMthInterestRate = Format(dblMthInterestRate, "$######.00")

For intCounter = 1 To (intYears * 12)

curTotalPayment = (curTotalPayment + curMonthlyPayment)
curTotalPayment = curTotalPayment + dblMthInterestRate
lstMonthlyDisplay.AddItem (intCounter & vbTab & Format(curTotalPayment, "$######.00"))

Next intCounter

The variable in red is the variable that has no value.


Compounding Interest
Using the foruma found at:

I need to solve for t (years) for: A = P (1 + r) ^ t

I am going to be given A, P, and R. I need this for a VB6 program.

Any help would be appreciated. Thanks!

Out Of Interest Question
If I would like to havein an app a Window (RTF or TXT or ...) which shows the
code of the app (ASM or even BIN) how would I do this

What I wand to say-

If you do somthing in your app the code for this (BIN) is shown

Out Of Interest Question
Greetings, what do you think is the advantage / disadvantage for the following senarios?

Ex1. Having a variable global for the whole app

Ex2. Having a variable in a class for the whole app

Ex3. Having a variable in a ATL for the whole app

Ex4. Having a variable in a DLL for the whole app

Interest Calculator
Does anyone have some example code for calculating monthly interest ?

As A Matter Of Interest...
I've read it somewhere (probably on this site!) how you can disble Ctrl+Alt+Del and stuff like that, and I even know how it works (you trick the computer into thinking a screensaver is running), but I can't for the life of me remember the code. Does anybody know?

Read This, Might Be Of Interest To You
Hello everyone...

I used to be a lone coder... but now I'm trying to get a group of coders/artists together, and make a small company (I don't like to call it that). I would like to know who's interested in joining me, the whole purpose of this is to learn, yes, learn, to learn from each other, and to learn how to work together in a team enviornment... We will be completely Non-Commercial.. whatever we make will be available for free, and sometimes even with source code, if you want to join, just reply here, and/or send me an email at "" (I preffer if you reply right here..) we will usually be working on graphical programs, like games, and/or internet projects or other typical aplications that won't look like your typical windows application but rather very graphical... we will also be learning in this process, learning to code in DirectX and so forth.. I've signed up for the website at "" the group will be called MF-Productions (MF = Don't ask me yet).... So if you guys are interested and have a lot of free time in hand and stuff like that, then join up, I'll only be taking like 6 people that are coders, and if you have any specialty like graphics and stuff, I'll pick you in the other category.. don't be offended if I don't pick you... ok???

Thanks a lot

Interest Rates Calculations?
Is their a excel function for calculating interest rate repayments?

Basicly what I have to do is set up an Excel sheet that allows amount, a period and an interest rate and the sheet calculates the repayments over the period?

I just thought that their maybe a excel functions that would do this for me??

Total Interest Paid
Can someone tell me how to calculate the total interest paid on a loan?
I have the payment calculated, I just need the total interest at the end of the loan.

Select Area Of Interest
I need to select an area of a picture I want to zoom into.I want to use the mouse to drag and select the area.How can this be done?currently the picture is loaded into a picture box and i am able to zoom into a fixed area of the picture....thanks for any help

Compounding Interest Problem
Working on a Wealth Accumulator program, in which the user inputs an amount for a monthly deposit, determines the number of times in a row it will be done, and the annual interest rate it will earn.

I have everything working except for the Interest Earned statement, if someone could look over my code, or the form attached to give me some pointer i would appreciate it as i'm spinning my wheels. I can't figure out the proper equation or something..

Option Explicit

Dim dblBalance As Currency

Dim sngMonthlyReturn As Currency 'the Monthly Return including Interest
Dim dblMonthlyInterest As Double 'dollars of interest earned this month
Dim dblTotalDeposited As Double 'Total Deposited accumlator
Dim dblTotalInterest As Double 'interst earned accumlator
Dim dblAccountBalance As Double 'Account Balance accumlator
Dim intCounter As Integer

Private Sub cmd_calculate_Click()
Dim sngMonthlyRate As Currency 'the monthly interest rate
sngMonthlyRate = (txt_annual_interest_rate) / 12 'determines the monthly interest rate
dblMonthlyInterest = 0
dblTotalDeposited = 0
dblTotalInterest = 0
dblAccountBalance = 0

For intCounter = 1 To txt_number_deposits.Text

dblTotalDeposited = dblTotalDeposited + txt_monthly_deposits
dblMonthlyInterest = (dblTotalDeposited * sngMonthlyRate) 'determines how much interest is earned each month
sngMonthlyReturn = txt_monthly_deposits + (dblMonthlyInterest) 'determines the return for a month

dblTotalInterest = dblMonthlyInterest * (txt_number_deposits)

dblBalance = (dblBalance) + (txt_monthly_deposits.Text * sngMonthlyRate)
dblTotalInterest = (dblTotalDeposited) * (sngMonthlyRate) * (txt_number_deposits.Text)

MsgBox (dblTotalInterest)
Next intCounter
dblAccountBalance = (dblTotalDeposited) + (dblTotalInterest)

txt_total_deposited.Text = FormatCurrency(dblTotalDeposited)
txt_interest_earned.Text = FormatCurrency(dblTotalInterest)
txt_final_balance.Text = FormatCurrency(dblAccountBalance)

End Sub

Calculate Simple Interest
I have a label and a single textbox and 2 command buttons ie Calculate & exit now i want to calculate simple interest ie Simple Interest=(principal*Time*Rate)/100 can u tell me how can i enter values and show the result only byt clicking 4 times in the one of the command button(ie calculate)
if possible please mail me at

Simple Interest Program Help!!
I am new to visual basic and I am trying to write a program that uses the formula interest = principal x rate x days / 365. I would input the rate and days for several loans and using the formula it would calculate and display the interest for each loan. I have worked on this and worked on this and still I cannot get it to work. It was a class assignment that I was not able to complete. I've finished the class but it still has me stumped. I took an internet based class for this. Book was not very good and needed more access to the teacher. Any suggestions, advice, etc???

Any Interest? Serverless Web Development
I've duplicated myself!

The original of this was moved to the Code Bank:

Edited by - dilettante on 7/3/2005 1:28:13 PM

Interest And Mortgage Calculating
Does anyone know where I might find VB code for calculating income interest (compounding method, simple, monthly, quarterly, etc.). Also would like to find code for calculating mortgage payments (maybe form that ask for loan amount, down payment, term, etc.)

Help: Dynamic Accrued Interest Calculator
I'm a hack begging for some help here.

Currently, we waste a lot of time calculating accrued interest and total months paid on clients revolving accounts (Credit Cards) using a java script (included Below) found on the web. Then imputing the results by hand. Slow and error prone.

Script follows:

//By Daniel C. Peterson
//Web Winder Website Services, 1997-2005 All Rights Reserved.
//Distribution, editing or reselling of this script is strictyly prohibited
//without expressed written permission from Daniel C. Peterson.
//For commercial grade (professional) versions of this and many other
//calculators, visit [url][/url].

function computeForm(form) {

var i = form.interest.value;

if (i > 1.0) {

i = i / 100.0;

form.interest.value = i;


i /= 12;

var j = form.minpayperc.value;

if (j > 1.0) {

j = j / 100.0;

j = j * 1;


var prin = eval(form.principal.value);

var pmt = 0;

var prinPort = 0;

var intPort = 0;

var count = 0;

accruedInt = 0;

while(prin > 0) {
if(eval(prin * j) < eval(form.minpaydol.value)) {pmt = eval(form.minpaydol.value); } else { pmt = eval(j * prin); }
intPort = eval(i * prin);
prinPort = eval(pmt - intPort);
prin = eval(prin - prinPort);
accruedInt = eval(accruedInt + intPort);
count = count + 1
if(count > 600) { break; } else { continue;}

<------more script of little importance------->

The reason I have not used Excel's built in functions? Not dynamic (can't use minimum payment or minimum percent paid). Of course if any know how this can be accomplished using built-in functions that would be great.

I'd like to write a series of functions that will dynamically calculate Accrued Interest-CCA (credit card accrued int) and Total Months-CCPer (credit card periods) as the above script does sourcing Balance (Principle), Interest Rate, MinPay (Dollars) and MinPay (Percent) from cells in the work sheet. Thus far (only a few hours work, I'm trying to learn VB simultaneously, so mercifully examine my attempt) my function script returns errors or zeros at best.

Submitted below are the two functions:

Public Function CCA(Bal As Currency, Rate As Integer, MinPay As Currency, _
MinPerc As Integer) As Currency
'Attribute CCA.VB_Description = "Calculates the accrued interest of revolving _

'Define variables
Dim Prin As Double
Dim IntP As Double
Dim PrinP As Double
Dim Pmt As Double
Dim AccInt As Double
Dim Count As Double

'Prepare Rates for calculation
If Rate > 1 Then Rate = Rate / 100
If MinPerc > 1 Then MinPerc = MinPerc / 100

'Source variables
Prin = Bal

'Loop Pmt until Pmt = 0
Do While Prin > 0
If (Prin * MinPerc) < MinPay Then
Pmt = MinPay 'Establish Var Pmt
Pmt = (Prin * MinPerc)
IntP = (Prin * Rate)
PrinP = (Pmt - IntP)
Prin = (Prin - PrinP)
AccInt = (AccInt + IntP)
Count = Count + 1
If Count > 600 Then Stop
End If

End Function

Public Function CCPer(Bal As Currency, Rate As Integer, MinPay As Currency, _
MinPerc As Integer) As Double
'Attribute CCPer.VB_Description = "CCPer calculates the months (periods) to pay_
off revolving credit making only the minimum payment."

'Define variables
Dim Prin As Double
Dim IntP As Double
Dim PrinP As Double
Dim Pmt As Double
Dim Count As Double

'Prepare Rates for calculation
If Rate > 1 Then Rate = Rate / 100
If MinPerc > 1 Then MinPerc = MinPerc / 100

'Source variables
Prin = Bal

'Loop Pmt until Pmt = 0
Do While Prin > 0
If (Prin * MinPerc) < MinPay Then
Pmt = MinPay 'Establish Var Pmt
Pmt = (Prin * MinPerc)
IntP = (Prin * Rate)
PrinP = (Pmt - IntP)
Prin = (Prin - PrinP)
Count = Count + 1
If Count > 600 Then Stop
End If

End Function

Any entrepenuers out there know if you have any abilities they will be used *cough* abused when starting a company, such is my plight (I've never coded a line in my life before yesterday)

All help is greatly appreciated.


P.S. I've also attached the

Annual Interest Rate Project
This is one of our final projects of the year and its **** hard! Any help would be appriciated.

Your program will prompt the user for an expected annual interest rate, a range of years that will be illustrated, and the rage of dollar value that can be invested at a set rate per year. The program will generate a table similar to the one that follows in figuar 1. ( I cant really type up the whole table!!)

The table in Figuar 1 demonstrates that $100 invested every year for 5 years at 6% will generate $597.53, and $500 invested every year for 25 years at 6% will generate $29,078.19.

Visual Basic has a function that will do most of the work for you.

FV(interest rate per paypment, number of payments, -dollar amount per payment)

note: the value generated by FV function does not include the interest for the last payment. You will need to consider the last interest payment in your calclation.

So far I have been able to get the first Horizontal and Vertical colombs which have the number of years and dollar value. 5 to 25 years. 100 to 500 dollars inc. 20.

i need to find out how to use the for next statment to get the rest.

Security Issue -- Of Guru Interest
Let me give an example of my concerns.

Today I was requested by the support staff of a large corporation to allow them to link to my computer.

To the best of my knowledge, I do NOT have Remote or Terminal Services loaded. Looking both in the registery and under system information everything appears normal -- no services running.

I NO longer had the companies Software loaded and had scanned the Registry and no entries appeared to be left over.

I did manually re-register their primary DLL (c:windowssystem)and included three other of their DLLs (c:windowssystem) -- these are supporting DLLs used by the primary DLL.

I dialed up a web address on their server, responded -- OK to access my system --, and instantly, they had control of the client side cursor.


1) How are they able to establish handshaking with my system which allows them complete control -- e.g. use of their DLL, Internet Explorer ???
2) Is there any way to limit their access to my HD once they're on my system?
3) Is there any way (program if you know of one) that will allow me to interactively monitor and log their activity while connected?



Interest Calculation Program [ Solved ]
Hello guys,

Can anyone please tell me how to calculate interest in a VB program, examples would do as well.

I actually need only the formula to calculate interest.



Need Help Figuring Recurring APR And Interest Rate
I have a database of customers which holds their personal and transactional data from the sale of books. Am including a sample of it.
What I have is a query that at the moment can't:

1. Figure the A.P.R. of 18% on the outstanding balance
(The interest calculated monthly and added to the balance before the monthly bill is issued).

Which I don't think would be to difficult as I've written this already into my query, but how do I make it see the next month, and the next month on any remaining balance if they have not paid in full yet?

2. All bills are issued on the last day of the month, and payment is due on the 15th of the following month.
(If payment is not received by the 15th, a late notice is mailed, and an additional 1% is added for overdue accounts...this is added to the balance as an additional interest.

Again, I can figure the interest cost, but how do I make it see the next month, and the next month on any remaining balance if they have not paid in full yet?

When I open the query, I would like it to adjust to see the new date, and adjust all figures (monthly A.P.R of 18% and interest accrued as late fee (1%)?

I am curious if I shouldn't be doing this with code. Any ideas, and suggestions on the way the database is setup to make this more accomodating to my goal, I'd sure appreciate the help.

Thank you

Frustrating - How To Do Coumpund Interest In VB? (harder Than It Sounds)
How would you do compound interest in VB, where the user inputs the time to pay the mortgage, the interest rate, and the cost of the mortgage now, and the program has to figure out the amount that needs to be paid per period.

at first i thought it would be simple but its not

I think the problem is why i dont know how to do it is that with a program like this, there can be many different values for the amount to pay per period to satisfy the criteria set by the user..

anyone know how to do this?

Visual Basic Program On Calculating Bank Interest
Hey, can anyone out there help me. i need to write a visual basic program on calculating bank interest and i haven't got a clue. Any help would be very much appreciated.

Formula For Interest Portion Of A Payment For A CANADIAN MORTGAGE (semi-annually)
I know about VB's functions to calculate mortgage payments. However they do not apply to Canadian mortgages which are compounded semi-annually as opposed to monthly.

I can calculate mortgage payments.
However in order to create amortization table, I also need to calculate interest portion of a mortgage payment for a CANADIAN MORTGAGE (compounded semi-annually).

What is the formula?

Compound File (aka Structured Storage File) Format
Hi Guys,

I am working on this file format for now. Before I dig into the low level (build my own Structure Storage File explorer) I am wondering if anyone of you has already worked on this using API or something else? I cannot get the docAPI (ie StgOpenStorage) to work in VB.

My objective is to identify file types without looking into the extension filename.. Or are there any other method?

Any ideas/help will be appreciated.

Thanks in advance.

Calculating A Compound Unit Value To Its Unit Value(VB6-SQL)

This's my first post. I hope this would be welcomed.

I have a small question here. I have two tables 'Units' and 'Compound' units and some data has been provided here to make you guys a little clear about the question.

I want to make an SQL query which returns the basic unit of a compound unit.

FYI, here we have two tables 'Units' and 'CompoundUnits'

----- Table Name = Units --------



--------- Table Name = CompoundUnits ------------

UnitNameShortCut UnitMultiple
Dozen dz Pieces12


Cartoon is a compound unit.

According to the above data ..

Cartoon = 500 Box
Box = 100 Packet
Packet = 15 Dozen
Dozen = 12 Pieces

Pieces itself is a basic unit.

Now coming to question ...

Please do help me make an SQL Stored Procedure or a VB 6 Function in which when a Compound Unit (Eg. Cartoon) is passed, returns its value in basic unit(Pieces).

The File Is Not A Valid Compound File.
Anyone knows what does this message mean?? This is the code I'm using:

VB Code:
Set cnn = ADOProcess     If cnn.State = adStateClosed Then cnn.Open
BTW, both cnn and ADOProcess are Connections.

Extra information.... the ADOProcess has this value: "File Name=\Chi-fsimpsatFoldersDokuvizDatalinksPR_ARG_IIS2_ARG.udl"

Copyright 2005-08, All rights reserved