Access VBA Code

This Access VBA is using a For Next loop and I understand most of the code but I have some areas that I'm not sure about. Can someone give me some in depth detail on the following code:

sngAmount = sngAmount + (sngAmount * (strRate / 100 / 12))

I understand the above is the formula for calculating the interest earned but I don't quite get dividing by "100" is that to make it currency to allow for two digits after the amount is achieved from the calculation?

I don't understand making the following variables as the data types chosen:

intI being "Dim" As integer

Why not make them all "single" or "double" how is a string even used in a math problem?
James CoatsComputer Info. Sys. StudentAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Haris DulicIT ArchitectCommented:

division is done to turn the strRate to percentile and then divide it by 12 to make it monthly interest rate than the result in brackets is added to the sngAmount .

Did not quite understand the issue : Why not make them all "single" or "double" how is a string even used in a math problem? Please clarify?
As a person would type in the percentage field in integers, the formula basically HAS to have the dividing by 100 to get to the real number to be calculated (the dividing by 12 is misleading though, as it's nullified by the * 12 in an earlier statement, and hence the For loop is a moot point too). The two digits was purely chosen for readability. It's a choice on how to display the number, nothing more.
Basically, you're reading too much behind it all.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
strRate is the Percentage Rate.  When working with percentages (4.5% for example), you would divide by 100 to give you .045 in your equation.  Not sure why it would be a String data type though.  I would think it would be a Double as well.  Unless they are including the % symbol along with it, but if that was so, then the formula would need to use VAL(strRate) to pull out the numeric portion.

Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

James CoatsComputer Info. Sys. StudentAuthor Commented:
Thank you all very much this made things a lot more clear.
Why not make them all "single" or "double" how is a string even used in a math problem?

This is a valid point.  I too am confused with the choices of Data Types here.  The variable strRate doesn't make sense at all, it should have been either Single or Double.  There also doesn't seem to be any basis on why the coder chose to make some as Single and others as Double.  YEAR should have been an Integer since it is a whole number.  Another option for YEAR would have been Byte since I doubt if you would ever use anything over 255 years in this project.

James CoatsComputer Info. Sys. StudentAuthor Commented:

Thank you for this comment, sorry that I can not give you some points.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.