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!

Reading database field values in .dsr file at run-time

Status
Not open for further replies.

vbadmin

Programmer
May 11, 2004
12
US
I have a table of employees in a mysql database and a blob field in that table that stores a picture of each employee. Some of the employees don't have a picture so that field is null. When I built a crystal report in Visual Basic showing those pictures for each employee, instead of showing nothing for the null ones, I want to display an image that says "no photo available". I put code in the .dsr file under the details event to check whether the field is null or not like so...

Private Sub DetailSection1_Format(ByVal pFormattingInfo As Object)

If IsNull(photoFile.value) Then
NoPhotoAvailable.Suppress = False
Else
NoPhotoAvailable.Suppress = True
End If

End Sub


The problem is that it doesn't read the value properly because the if value always returns "empty". I tried to find a property of the photoFile object that would read the value but the only one that I thought might work was the .field property. So I changed the code like so...


Private Sub DetailSection1_Format(ByVal pFormattingInfo As Object)

If IsNull(photoFile.field) Then
NoPhotoAvailable.Suppress = False
Else
NoPhotoAvailable.Suppress = True
End If

End Sub


This didn't work either. Does anyone know what I'm doing wrong?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top