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




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 uddipto_banerji@indiatimes.com




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
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

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???

How To Calculate Simple Math Formula?
My question is this:
How do I work the following problem in Visual BAsic?
= ((102/(102+308))*((998.99-385-385))+385
= (.24878)*(228.99)+385
= 441.97 to get this exact answer

I must have 5 decimal places in the first part, and I keep trying different types of parentheses in order to get the appropriate order of operations but still no luck.
Do I use "= Round((102/(102+308)),5)"
As you might imagine, there are variables in each of these
places that show number values but I figured it would be more easily understood in this format. Thanks for any help you can provide as I am just getting started in VB.
w3000

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.

Code:
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
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.

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.

CAN ANYONE HELP.

Compounding Interest
Using the foruma found at: http://www.vbforums.com/showthread.p...nding+interest

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 "falcon@punkass.com" (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 "http://MFProductions.tripod.com/" 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

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 this

no. 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.

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.
Thanks
Dale

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..


Code:
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

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

The original of this was moved to the Code Bank:

http://www.vbcity.com/forums/topic.asp?tid=93772



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:

Code:
//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]http://www.webwinder.com[/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:


Code:
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 _
credit."

'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
Else
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
Loop

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
Else
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.

DBG

P.S. I've also attached the spreadsheet.zip

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.

Michelle

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

Thanks

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.

QUESTIONS

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?

Thanks
David

Thanks
David

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.

Thanx

Hannes

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
NMP

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)
Hi,
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?
Thanks,
Tom

Calculate During A VBA-sub
Hello,

I have calculation set to off and would like to update my sheet at a certain moment during running a VBA-sub (VBA-programcode). In this VBA-sub, a refresh is made from a web query.

I inserted the command Calculate in my code and also the command EnableCalculation.

Still the sheet is only calculated at the end of the VBA-sub and not immediately after the Calculate command.

Is there a way to calculate the sheet during running of a VBA sub?

Thank you!

regards,
Marcel

Calculate Pi
just want to confirm - is this correct?

Code:
Public Pi As Long
Public Deg2Rad As Single

'Some Sub
Pi = Atn(1) * 4
Deg2Rad = Pi / 180
and is it useful / better than just writing in a few digits?

thanks

How Do I Calculate YTD In VB6
How do I calculate the YTD in VB6.

What date functions do I use?

If today was 6/1/2008 then i need get get 1/1/2008 as by beginning date right?

Ado Calculate
Hi, Guy's
I Have ADO Database That Containe fields:
DateL,SL,NoteL,DateR,SR,NoteR.
i want calculate the total of second fields(SL) And Fivth Fields(SR)
in Label1.caption,Label2.caption (data Grid Table)
Do You Have A Code Please????

Milen

Can Someone Calculate This
Hello,

Can someone please tell me how much disk space will a 2000 characters string will take.

I want to see if it is a good idea to store an electronic signature for every customer in the data base. The signature could be up to 2000 HEX characters long.

Please let me know what would be the best way to keep the electronic signature stored for each customer. First I thought I will keep IMAGES for each signature (.JPG files in a folder) then thought that if it is not too costly to store in the same table where the customer info resides then I shold store it there. Please let me know the best way posible.

Thanks.

Calculate T/h
I am programming a Process Control System Simulation over a feed plant.
On the top of the plant I have a weight which feed the system with material....I now need to calculate the flow from the wheight in t/h....but I just can't figure it out...I have tried everything!

The wheight is simulated by a timer with 500 as Interval. And it is the variable WheightFlow that decides how much material that passes through the system each time the timer executes. (WheightFlow can be adjusted by a scrollbar from 3 to 24 t/h)

The total amount of material wheiged out is stored in the variable TotalWheight and is messured in kg.

Can anyone help me with this???

Calculate
I'm making a small program that should let you calculate a leagues play dates like below:

First round:
--------------
Team1 - Team2
Team3 - Team4

Second round:
--------------
Team1 - Team3
Team2 - Team4

Third round:
--------------
Team1 - Team4
Team2 - Team3
and so on...of course the teams also changes betwenn playing home and away, but you get the point!

You should also be able to set how many times the teams should meet each other!

How do i do this kind of calculation?
How do i do when there is uneven number of teams?

Many thanx
Johan

What Is The Best Way To Calculate Fps
i don't want to use a timer because it's inaccurate
i'm thinking of using ticks but i don't know how long a tick is
any other good methods to getting the fps ?
thanks

Calculate Age
I have a function that calculates the age of someone. The problem is that I am using a database with about 6000 records and each record goes through this process and really slows down the record retrieving process. Is there any way I can speed this process up? I thought about using a statement in SQL, but I havn't found anything yet.
Thanks

Public Sub RetrieveDebtors(ClientId as String)
Dim lstItem as ListItem
Dim intItem as Integer
Dim intCount as Integer

'Retrieves the count of records to be accessed
Set recDebtors = dbsData.OpenRecordset("SELECT COUNT(*)" & _
" AS intCount FROM Debtors WHERE ClientId = '" & _
ClientId & "'")
intCount = recDebtors!intCount

'Retrieves the records
Set recDebtors = dbsData.OpenRecordset("SELECT * FROM " & _
Debtors WHERE ClientId= '" & strDebtorId & _
"' ORDER BY DebtorId DESC")

'Adds the items to the list
For intItem = 1 To intCount
Set lstItem = vewNotes.ListItems.Add()
With lstItem
.SmallIcon = 1
.Key = recDebtors!Id
.Text = FullName(recDebtors!First, recDebtors!Last)
.SubItems(1) = recDebtors!Birthdate
.SubItems(2) = Age(recdebtor!Birthdate)
End With
recNotes.MoveNext
Next
End Sub()

Private Function Age(ByVal strBirth As Date) As Integer
Dim intYear As Integer
Dim strCurrent As String
Dim datBirth As Date

datBirth = CDate(strBirth)
If datBirth <= Date Then 'Date selected is less
'than current date
strCurrent = Format(Date, "mm/dd")
strBirth = Format(strBirth, "mm/dd")
intYear = Year(Date) - Year(cboBirthday)

'Determines is month and day of birth has exceeded
'the current month and day
If strCurrent < strBirth Then
'Current month and day has not reached the
'birth month and day
intYear = intYear - 1
End If

Else 'Date selected is greater than current date
MsgBox "The birthdate selected is greater " & _
"than the current date.", vbInformation, "Birthdate"
intYear = 0
End If

Age = intYear 'Returns the age
End Function

Age Calculate
hi all

i need code for age calculate
please if any body have it mail to me
thenk you

ali42@hotmail.com

How To Calculate Everyone' Age
Hi all,

I have a problem. The person who give the born date and
the dead date, how to calculate the person' age. And also give the born date and age, how to calculate the dead date.

Thank!

How Do Calculate With An Ado?
Hello again! I have moved forward with my project and now I am stuck again.

 I have to keep an inventory and in doing so I have a Reorder number that is entered when then the part is added to inventory and as I sell an item I need to subtract it from the quantity on hand and update my "reoder point" for printing a report. I am using Access2K and I am baffled as how to perform this procedure and be able to print it out. Does this make sense?

I am open to all suggestions...You all are a great help to a novice like me, Thanks!

Sissy

Please Ho Do I Calculate....
Runnig total of hours worked(daily/weekly/monthly) and the updating of changed data in VBA.
And To check that there are no overlapping hours (overlapping
appointments are OK, but the ones starting with an integer are not
permitted to
overlap). A RED error ticket may be generated or some other form of
error
message should be displayed to the user in error condition.

TO make a balance correction - if needed based on special "balance
correction" appoinment on the day given for the future days
 
 To produce a (given time span) report of used working hours to
specific codenumber or task. This is extra bonus feature


I would appreciate if someone could help me out here(snippets, etc).
thanks in advance

Still Can't Calculate
I have change my code, replacing all Vals with CInt and CSng, but it still won't calculate:

Option Explicit


Private Sub cmdCalc_Click()
Dim sngDollars As Single, sngQuarters As Single, sngDimes As Single, sngNickels As Single, sngNPennies As Single
Dim intPennies As Integer
'assign values to variables
intPennies = Val(InputBox("Enter the number of pennies", "Number of Pennies"))
sngDollars = CSng(lblNdollars.Caption)
sngQuarters = CSng(lblNquarters.Caption)
sngDimes = CSng(lblNdimes.Caption)
sngNickels = CSng(lblNnickels.Caption)
sngNPennies = CSng(lblNpennies.Caption)
'perform calculations
sngDollars = CSng(intPennies) / 100
sngQuarters = CSng(lblNdollars.Caption) - CSng(intPennies) / 25
sngDimes = CSng(lblNquarters.Caption) - CSng(intPennies) / 10
sngNickels = CSng(lblNdimes.Caption) - CSng(intPennies) / 5
sngNPennies = CSng(intPennies) / 1
End Sub



Private Sub cmdClear_Click()
'clear the screen for next amount
lblNdollars.Caption = ""
lblNquarters.Caption = ""
lblNdimes.Caption = ""
lblNnickels.Caption = ""
lblNpennies.Caption = ""
End Sub


Private Sub cmdExit_Click()
End
End Sub

Private Sub cmdPrint_Click()
'hide command buttons before printing the form
cmdCalc.Visible = False
cmdPrint.Visible = False
cmdClear.Visible = False
cmdExit.Visible = False
'display command buttons after the form is printed
cmdCalc.Visible = True
cmdPrint.Visible = True
cmdClear.Visible = True
cmdExit.Visible = True
cmdClear.SetFocus
End Sub
End Sub

Private Sub Form_Load()
'center the form
frmJpennies.Top = (Screen.Height - frmJpennies.Height) / 2
frmJpennies.Left = (Screen.Width - frmJpennies.Width) / 2
End Sub



kazooie21

Can't Calculate
I have the following code:
[vbcode]Private Sub cmdCalc_Click()
Const strMsg As String = "The number of pennies was "
Dim sngDollars As Single, sngQuarters As Integer, sngDimes As Integer, sngNickels As Integer, sngNPennies As Integer
Dim intPennies As Integer
'assign values to variables
intPennies = Val(txtPennies.Text)
sngDollars = Val(lblNdollars.Caption)
sngQuarters = Val(lblNquarters.Caption)
sngDimes = Val(lblNdimes.Caption)
sngNickels = Val(lblNnickels.Caption)
sngNPennies = Val(lblNpennies.Caption)
'perform calculations
sngDollars = Val(intPennies) / 100
sngQuarters = Val(lblNdollars.Caption) - intPennies / 25
sngDimes = Val(lblNquarters.Caption) - intPennies / 10
sngNickels = Val(lblNdimes.Caption intPennies / 5
sngNPennies = Val(intPennies)
lblMsg.Caption = strMsg & Format(intPennies, "Number of Pennies")
End Sub

Private Sub Form_Load()
Const conPrompt As String = "Enter the number of pennies"
Const conTitle As String = "Number of Pennies"
Dim intPennies As Integer
intPennies = Val(InputBox("Enter the number of pennies", "Number of Pennies"))
'center the form
frmJpennies.Top = (Screen.Height - frmJpennies.Height) / 2
frmJpennies.Left = (Screen.Width - frmJpennies.Width) / 2
End Sub

I unable to calculate the number of pennies. AM I doing something wrong? I KNOW this is the right formula. Furthermore, when I enter the number of pennies into the input box, it doesn't show up on the form.

kazooie21

Calculate
I am taking the value of a number and multiplying it by .20. Then the I am trying to take the new value and subtract t from the original number. What am I doing wrong here?

option Explicit

private Sub cmdCalculate_Click()
Dim GrossSalary as Double
Dim GrossSalaryCalc as Double
Dim TaxLoss as Double
Dim NetSalary as Double
Dim YearlySalary as Double

GrossSalary = Val(txtGrossSalary.Text)
'GrossSalaryCalc = GrossSalary - TaxLoss
TaxLoss = Val(lblTaxLoss.Caption)
'NetSalary = Val(lblNetSalary.Caption)
'YearlySalary = Val(lblYearlySalary.Caption)

lblTaxLoss.Caption = GrossSalary * 0.2
lblNetSalary.Caption = GrossSalary - TaxLoss
lblYearlySalary.Caption = GrossSalary * 24

End Sub

private Sub cmdClear_Click()
txtGrossSalary.Text = ""
lblTaxLoss.Caption = ""
lblNetSalary.Caption = ""
lblYearlySalary.Caption = ""
txtGrossSalary.SetFocus

End Sub

private Sub cmdExit_Click()
End

End Sub

private Sub cmdPrint_Click()
PrintForm

End Sub

Copyright 2005-08 www.BigResource.com, All rights reserved