The following code works great when there are records in the database, but when there are NO records I get an Exception error that I can't seem to fix. Any help would be greatly appreciated.
10 sqlStringa = "SELECT OrganizationID FROM RegionalContracts WHERE Region=" & "'" & strSelectedRegion & "'"
20 Set ReportRS = Con.Execute (sqlStringa)
(I am retrieving OrganizationID's)
30 WHILE NOT ReportRS.EOF
(For each OrganizationID from line 20, I am retrieving ActiveFiles and ClosedFiles with line 40)
40 sqlStringb = "SELECT * FROM Reporting WHERE OrganizationID =" & ReportRS("OrganizationID"& " AND Year=" & strYear & " AND Quarter=" & strQuarter
50 Set Rst = Con.Execute (sqlStringb)
60 strActiveFiles = strActiveFiles + Rst("ActiveFiles"
70 strClosedFiles = strClosedFiles + Rst("ClosedFiles"
(In 60 and 70, I am getting a sum of ActiveFiles and ClosedFiles)
80 ReportRS.MoveNext
90 WEND
Works great when there are records, but with no records it crashes.
10 sqlStringa = "SELECT OrganizationID FROM RegionalContracts WHERE Region=" & "'" & strSelectedRegion & "'"
20 Set ReportRS = Con.Execute (sqlStringa)
(I am retrieving OrganizationID's)
30 WHILE NOT ReportRS.EOF
(For each OrganizationID from line 20, I am retrieving ActiveFiles and ClosedFiles with line 40)
40 sqlStringb = "SELECT * FROM Reporting WHERE OrganizationID =" & ReportRS("OrganizationID"& " AND Year=" & strYear & " AND Quarter=" & strQuarter
50 Set Rst = Con.Execute (sqlStringb)
60 strActiveFiles = strActiveFiles + Rst("ActiveFiles"
70 strClosedFiles = strClosedFiles + Rst("ClosedFiles"
(In 60 and 70, I am getting a sum of ActiveFiles and ClosedFiles)
80 ReportRS.MoveNext
90 WEND
Works great when there are records, but with no records it crashes.