Please help fix my If statement

  • Thread starter Thread starter Than
  • Start date Start date
T

Than

Guest
I try to run below if statement in the report code. When there is no student's image, the picture should be noimage.jpg. However, it always skips the true condition even if Me![Photo_location] = Null. Please take a look my attachment and unzip it in "C:\"

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

Dim Path As String

'path to the folder with the images
Path = ""

If Me![Photo_location] = Null Then
Me![Image1].Picture = "C:\CMIS108\pic\noimage.jpg"
Else
Me![Image1].Picture = Path & Me![Photo_location]
End If

End Sub

please download my file at "http://s93230472.onlinehome.us/temp/cmis108.zip" . The file size is about 1.31 MB
 
If IsNull(fieldname) Then

Not fieldname = Null as you can't equate a value to be equal to an unknown value.
 
You need to have a file called noimage.jpg. Create one with just a text field saying no image and it works just fine.
 
SJ McAbney said:
If IsNull(fieldname) Then

Not fieldname = Null as you can't equate a value to be equal to an unknown value.


Thank you so much SJ. It works!

but, why doesn't "If Me![Photo_location] Is Null" work? Please explain me if it is not the same thing as your If statement . Thanks in advance. :)
 
Last edited:

Users who are viewing this thread

Back
Top Bottom