Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I use a division operator inside a while loop?

Status
Not open for further replies.

d1004

Programmer
May 9, 2002
78
US
I test the following code in other arimethic like substraction, addition, and multiplication.
However, the division operator give me an overflow error msg. Does anybody knows why? Please help.


while (NOT objRS.EOF)



Set objConn = Server.CreateObject("ADODB.Connection")
objConn.open strConnect

strSQL= "SELECT Count(tblSurveyRawData.Q35G) AS CountOfQ35G " & _
"FROM tblRep " & _
"INNER JOIN tblSurveyRawData ON tblRep.Rep_ID = tblSurveyRawData.Rep_ID " & _
"WHERE " & _
"tblSurveyRawData.[MONTH/YEAR] Between #" & BeginYrDate & "# AND #" & EndingDate & "# " & _
"AND [Rep_FirstName] & ' ' & [Rep_LastName] = '" & objRS("IndividualRep") & "' " & _
"AND (tblSurveyRawData.Q35G Is Not Null)"

set rs = objConn.Execute (strSQL)

Q35GYrTotal = rs("CountOfQ35G")

rs.close
objConn.close
set objConn = Nothing
set rs = Nothing


Set objConn = Server.CreateObject("ADODB.Connection")
objConn.open strConnect


strSQL= "SELECT Count(tblSurveyRawData.Q35A) AS CountOfQ35A " & _
"FROM tblRep " & _
"INNER JOIN tblSurveyRawData ON tblRep.Rep_ID = tblSurveyRawData.Rep_ID " & _
"WHERE " & _
"tblSurveyRawData.[MONTH/YEAR] Between #" & BeginYrDate & "# AND #" & EndingDate & "# " & _
"AND [Rep_FirstName] & ' ' & [Rep_LastName] = '" & objRS("IndividualRep") & "' " & _
"AND (tblSurveyRawData.Q35A = 9 OR tblSurveyRawData.Q35A = 10)"

set rs = objConn.Execute (strSQL)

yr35A910 = rs("CountOfQ35A")

rs.close
objConn.close
set objConn = Nothing
set rs = Nothing

yr35A910 = yr35A910 / Q35GYrTotal

Response.write &quot;<TR>&quot; & &quot;<TABLE BORDER = '3'>&quot; & &quot;<tr><td bgcolor = '#00FF99' width = '150'><font size = '3'>&quot; & objRS(&quot;IndividualRep&quot;) & &quot;</font>&quot; & &quot;<td width = '90' align = 'center'><font size = '3'>&quot; & yr35A910 & &quot;</font></table>&quot;


objRS.MoveNext
Wend
 
Maybe Q35GYrTotal = 0 ?
This is not a bug - it's an undocumented feature...
;-)
 
Thank you so much, that explains it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top