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!

Checking database fields on the fly in CR9 dsr report

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 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) 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 statement is always false. 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?
 
Can you create a picture that has 'No Photo Available' in it (using paintbrush or some similar tool) and then add that to the blob field for each employee that doesn't have a photo? I know it's not the answer you're looking for - but I guarantee it will work!

Peter Shirley
 
You're right. That would be a solution; however, I'm still curious to know how to check values on other fields from my employee table so I can modify my report on the fly.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top