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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Overflow error - ADO recordset populated through SQL Query to Access 1

Status
Not open for further replies.

elvenmaiden

Programmer
Apr 25, 2002
31
US
I am getting an overflow error message if there is information in access to populate the recordset.

Dim datBegin As Date 'holds begin date of report for recordset generation
Dim datEnd As Date 'holds end date of report for recordset generation

If mintDepartmentID > 0 Then
If mstrUser <> &quot;&quot; Then
If DTPBegin.Value > 0 Then
If DTPEnd.Value > 0 Then
If mstrSort <> &quot;&quot; Then
Set rsStats = conHelpPlus.Execute(&quot;SELECT qryStats.Name, qryStats.Subject, qryStats.Questions, qryStats.Solutions, SUM(qryStats.Accepted/qryStats.Solutions) as AcceptanceRate from qryStats WHERE qryStats.UserEmail = '&quot; + mstrUser + &quot;' GROUP BY qryStats.Name, qryStats.Subject, qryStats.Questions, qryStats.Solutions&quot;)
Set DataReport1.DataSource = rsStats
DataReport1.Show
Else
MsgBox &quot;Please select sort method for report.&quot;
optSort(0).SetFocus
End If
Else
MsgBox &quot;Please select an ending date for report.&quot;
DTPEnd.SetFocus
End If
Else
MsgBox &quot;Please select a beginning date for report.&quot;
DTPBegin.SetFocus
End If
Else
MsgBox &quot;Please select a user&quot;
lstUser.SetFocus
End If

Else
MsgBox &quot;Please select a department&quot;
lstDepartment.SetFocus
End If
 
Is there a possibility that qryStats.Solutions can be zero. This would throw a divide by zero error. The other possibility is that the SUM(qryStats.Accepted/qryStats.Solutions) calculation is returning a very large value. I think you need to check the possible values of qryStats.Solutions.

Andy
 
Thank you AndyDuke! I did have a divide by zero. Earlier in programming this I was remembering, but at 4:00 a.m. it's hard to remember all prior thought processes.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top