Image Debugging

xtinct

Registered User.
Local time
Tomorrow, 03:37
Joined
Nov 8, 2006
Messages
15
i have entered the following codes

Code:
Private Sub Image47_Click()
Dim DBpath As String
On Error GoTo Err_Image47_Click

    If IsNull([Yield Trend Chart]) Then
        Me.Image47.Picture = "K:\Staff Folders\JinLong\New Folder\nochart.jpg"
    Else
    DBpath = [Yield Trend Chart]
    Me.Image47.Picture = DBpath
    End If
    
Err_Image47_Click:
    Me.Image47.Picture = "K:\Staff Folders\JinLong\New Folder\nochart.jpg"
    
End Sub

i should display the image if the file is valid and if the is an error, the image shall be set to "K:\Staff Folders\JinLong\New Folder\nochart.jpg".

by using the above code, when the image is invalid, it is set to "K:\Staff Folders\JinLong\New Folder\nochart.jpg"

but when the image is valid, it also set the image as "K:\Staff Folders\JinLong\New Folder\nochart.jpg"

how to solve this problem?
 
Try:

If IsNull([Yield Trend Chart]) or ([Yield Trend Chart]) = "" Then....


If the field has had data, it is now empty, not null

Dave
 
actually my code is fine.. it is working.. after i added

Code:
Private Sub Image47_Click()
Dim DBpath As String
On Error GoTo Err_Image47_Click

    If IsNull([Yield Trend Chart]) Then
        Me.Image47.Picture = "K:\Staff Folders\JinLong\New Folder\nochart.jpg"
    Else
    DBpath = [Yield Trend Chart]
    Me.Image47.Picture = DBpath
    End If
    [b]Exit Sub[/b]

Err_Image47_Click:
    Me.Image47.Picture = "K:\Staff Folders\JinLong\New Folder\nochart.jpg"
    [b]Exit Sub[/b]
End Sub

the program is working what i wanted it to... :)
 

Users who are viewing this thread

Back
Top Bottom