473,394 Members | 1,699 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Why is my calculation coming out as 0

I have the following code - but the calculation is coming out to be 0
rather than the percentage.

Any ideas?

Thanks

Function GetAdoptionRate() As Integer
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strSQL As String
Dim datStart, datEnd, d1 As Date
Dim intTelemedReceives As Integer
Dim intMUApps As Integer
Dim intAdoptionRate As Double

Set db = CurrentDb()

Set rs = db.OpenRecordset("SELECT * FROM qryTelemedReceives",
dbOpenDynaset)
With rs
.MoveFirst
intTelemedReceives = rs("CountOfPolicyNumber")
End With

Set rs = db.OpenRecordset("SELECT * FROM
qryMedicallyUnderwrittenReceives", dbOpenDynaset)
With rs
.MoveFirst
intMUApps = rs("CountOfPolicyNumber")
End With
Debug.Print Format(intTelemedReceives \ intMUApps, "Percent") <-------
returns 0

Set db = Nothing
Set rs = Nothing
End Function

FYI intMUApps = 24,000 and intTelemedReceives = 4,000

TIA

Jan 2 '07 #1
2 1683
"BerkshireGuy" <be*************************@yahoo.comwrote in message
news:11**********************@48g2000cwx.googlegro ups.com...
>I have the following code - but the calculation is coming out to be 0
rather than the percentage.

Any ideas?

Thanks

Function GetAdoptionRate() As Integer
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strSQL As String
Dim datStart, datEnd, d1 As Date
The line above will make datStart and datEnd as Variants. Only d1 will be a
Date. I assume that this is not what you want. It is not related to your
problem
Debug.Print Format(intTelemedReceives \ intMUApps, "Percent") <-------
returns 0
The back-slash \ operator performs Integer Division where the result has all
fractional portions truncated. I suspect that if you used a forward slash /
that you would get what you want.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
Jan 2 '07 #2
Rick:

Thank you! I would have NEVER picked up on that - especially a day
after New Years! :)

Thanks again,
Brian

Rick Brandt wrote:
"BerkshireGuy" <be*************************@yahoo.comwrote in message
news:11**********************@48g2000cwx.googlegro ups.com...
I have the following code - but the calculation is coming out to be 0
rather than the percentage.

Any ideas?

Thanks

Function GetAdoptionRate() As Integer
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strSQL As String
Dim datStart, datEnd, d1 As Date

The line above will make datStart and datEnd as Variants. Only d1 will be a
Date. I assume that this is not what you want. It is not related to your
problem
Debug.Print Format(intTelemedReceives \ intMUApps, "Percent") <-------
returns 0

The back-slash \ operator performs Integer Division where the result has all
fractional portions truncated. I suspect that if you used a forward slash /
that you would get what you want.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
Jan 2 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Aspersion | last post by:
I'm building an ASP page that has a lot of text and graphics. There is a calculation facility on the page. The user enters several numbers in a form and presses a button to see the calculated...
0
by: anaxamandr | last post by:
Hi. I have a long loop in ASP that performs a rather lengthy calculation. I would love for my users to be able to stop that calculation, if they so choose, mid way through the process. I attempted...
2
by: Del | last post by:
Thanks in advance for any help. I have a database that was created in Access 2000. Several users have been upgraded to Access 2003. Since upgrading to 2003 we have noticed that some of the...
7
by: Vinoth | last post by:
I'm working in an ARM (ARM9) system which does not have Floating point co-processor or Floating point libraries. But it does support long long int (64 bits). Can you provide some link that would...
4
by: Michiel Alsters | last post by:
Hello everybody, I hope anybody can help me. I'll try to give a brief overview of my problem. I have running a program that performs a heavy calculation. To give the user feedback what the...
4
by: vg-mail | last post by:
Hello all, I have identical design for form and report but I am getting calculation error on form and everything is OK on report. The form and report are build up on SQL statement. The...
6
by: igotyourdotnet | last post by:
I have a dataset that is populating my gridview, but I have a data in the dataset coming out like .011 and showing in the gridView as .011%. I need to calculate that so it shows as 1.1% and not...
5
by: The alMIGHTY N | last post by:
Hi all, Let's say I have a simple math formula: sum (x * y / 1000) / (sum z / 1000) I have to do this across 50 items, each with an x, y and z value, when the page first loads AND when a...
3
by: mattmao | last post by:
Okay, I was asked by a friend about the result of this limit: http://bbs.newwise.com/attdata/forumid_14/20070922_fe7f77c81050413a20fbDWYOGm7zeRj3.jpg Not n->zero but n-> + infinite I really...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.