|
Subject:
|
Wont Give me a Percent
|
|
Posted By:
|
Odifius
|
Post Date:
|
9/20/2006 3:57:23 PM
|
Throughout my pogram I am adding up numbers in the lngPercentFit var and then I divide it by lngTotalTtl( I just set it to 5 for this example) The problem is that all I can ever get it to return to the field is 0.00% or like 100.00% or 300.00%. If it dosent divide evenly I get 0%. I have also tried double as a datatype with the same results. Any light you can shed would be greatly appreciated.
Dim lngPercentFit As Single Dim lngTotalTtl As Single
lngPercentFit = 5 lngTotalTtl = rstTotalTbl![LS_Fit_Weld_Visual] + rstTotalTbl![GW_Fit_Weld_Visual] + rstTotalTbl![RW_Fit_Weld_Visual] + rstTotalTbl![FW_Fit_Weld_Visual]
rstResultTbl.Edit rstResultTbl![% Completed] = lngPercentFit / lngTotalTtl rstResultTbl.Update rstResultTbl.MoveNext
|
|
Reply By:
|
pjm
|
Reply Date:
|
9/21/2006 11:01:54 AM
|
A solution doesn't jump out at me. While the 2 variables in the code are declared as Single, I can't tell if you have the table field defined as Single (or Double).
The slightly confusing thing about your code is that the prefix "lng" is usually used (in my experience) to mean Long Integer. Obviously this will not effect your result but it is confusing none-the-less.
-Phil-
|
|
Reply By:
|
Odifius
|
Reply Date:
|
9/21/2006 12:24:48 PM
|
Yeah, I figured it out. It was as you mentioned, I didnt have the fields in my table declared as Single. I also changed the lng to sgl :P Thanks for the input
JR
|