Dear all,
I have a crystal report which has a lot of detaildections. In 3 sections there are 3 subreports. (1 subreport per section).
If there is no data available I would like to hide the section. This works perfectly for the no subreport sections.
It also works perfectly if there is no data in the whole subreport.
However in some cases the subreport also has section and if there is not data for that one particular section I would like to hide it. I can do this, but then it hides that section for all records in that subreport. I only want it for that specific section.
I hope that makes sense. If you need more info please ask.
My code is as follows:
Do While Not rs.EOF
bFound = True
With dsCVForClient
.dtPersonalDetails.Rows.Add(rs.Fields(0).Value, rs.Fields(1).Value, rs.Fields(2).Value, rs.Fields(3).Value, rs.Fields(4).Value, rs.Fields(5).Value, rs.Fields(6).Value, rs.Fields(7).Value, rs.Fields(8).Value, rs.Fields(9).Value, rs.Fields(10).Value, rs.Fields(11).Value, rs.Fields(12).Value, rs.Fields(13).Value, rs.Fields(14).Value, rs.Fields(15).Value, rs.Fields(16).Value, rs.Fields(17).Value, rs.Fields(18).Value, rs.Fields(19).Value, rs.Fields(20).Value, rs.Fields(21).Value, rs.Fields(22).Value, rs.Fields(23).Value, rs.Fields(24).Value, sClient, sVacancy, sConsultant)
rsInHouse = gCnn.Execute("select regno, tertiaryinstitute, course, duration, completed, subjects from tertiaryeducation where regno = '" & sRegNo & "'")
Do While Not rsInHouse.EOF
For i = 0 To 5
If rsInHouse.Fields(i).Value = "" Then sTertiaryEducation(i) = "Not specified" Else sTertiaryEducation(i) = rsInHouse.Fields(i).Value
Next
.dtInHouseOtherCourses.Rows.Add(sTertiaryEducation(0), sTertiaryEducation(1), sTertiaryEducation(2), sTertiaryEducation(3), sTertiaryEducation(4), sTertiaryEducation(5))
rsInHouse.MoveNext()
Loop
rsJobHistory = gCnn.Execute("select regno, company, jobtitle, datestarted, dateleft, tasks, reasonleft, duties from jobhistory where regno = '" & sRegNo & "' order by datestarted DESC")
Do While Not rsJobHistory.EOF
For i = 0 To 6
If rsJobHistory.Fields(i).Value = "" Then sJobHistory(i) = "Not specified" Else sJobHistory(i) = rsJobHistory.Fields(i).Value
Next
If rsJobHistory.Fields(7).Value <> "" Then
If sJobHistory(4) = "0000-00-00" Then .dtJobHistory.Rows.Add(sJobHistory(0), sJobHistory(1), sJobHistory(2), sJobHistory(3) & " to current" & vbCrLf & vbCrLf & rsJobHistory.Fields(7).Value, sJobHistory(5), sJobHistory(6)) Else .dtJobHistory.Rows.Add(sJobHistory(0), sJobHistory(1), sJobHistory(2), sJobHistory(3) & " to " & sJobHistory(4) & vbCrLf & vbCrLf & rsJobHistory.Fields(7).Value, sJobHistory(5), sJobHistory(6))
Else
If sJobHistory(4) = "0000-00-00" Then .dtJobHistory.Rows.Add(sJobHistory(0), sJobHistory(1), sJobHistory(2), sJobHistory(3) & " to current", sJobHistory(5), sJobHistory(6)) Else .dtJobHistory.Rows.Add(sJobHistory(0), sJobHistory(1), sJobHistory(2), sJobHistory(3) & " to " & sJobHistory(4), sJobHistory(5), sJobHistory(6))
End If
rsJobHistory.MoveNext()
Loop
rsReferences = gCnn.Execute("select regno, nameofreference, designation, refcompany, reftelephone, refcellphone, reportedto, verifydates, closelysupervised, supervisestaff, nostaff, howwell, relsubordinates, relcolleagues, relsuperiors, relcustomers, meetobjectives, handlepressure, accuracy, reliability, honest, honestreporting, comparitiveresults, refstrengths, refweaknesses, attendance, reason, specificskills, rehire, refspecialachievements, otherinformation, comments from refercheck where regno = '" & sRegNo & "'")
Do While Not rsReferences.EOF
For i = 0 To 31
If rsReferences.Fields(i).Value = "" Then sReferences(i) = "Not specified" Else sReferences(i) = rsReferences.Fields(i).Value
Next
If sReferences(7) = "1" Then sReferences(7) = "Yes" Else sReferences(7) = "No"
If sReferences(9) = "1" Then sReferences(9) = "Yes" Else sReferences(9) = "No"
.dtReferences.Rows.Add(sReferences(0), sReferences(1), sReferences(2), sReferences(3), sReferences(4), sReferences(5), sReferences(6), sReferences(7), sReferences(8), sReferences(9), sReferences(10), sReferences(11), sReferences(12), sReferences(13), sReferences(14), sReferences(15), sReferences(16), sReferences(17), sReferences(18), sReferences(19), sReferences(20), sReferences(21), sReferences(22), sReferences(23), sReferences(24), sReferences(25), sReferences(26), sReferences(27), sReferences(28), sReferences(29), sReferences(30), sReferences(31))
rsReferences.MoveNext()
Loop
End With
rs.MoveNext()
Loop
Many thanks
Andrew
|