Code for image

xtinct

Registered User.
Local time
Tomorrow, 03:37
Joined
Nov 8, 2006
Messages
15
Code:
Private Sub Form_Load()
DoCmd.Maximize
Me.Image56.Picture = "K:\Staff Folders\JinLong\New Folder\default.jpg"
End Sub

Private Sub Image56_Click()
Dim DBpath As String
    If [Yield Trend Chart].Value Is Not Null Then
    DBpath = [Yield Trend Chart]
    Me.Image56.Picture = DBpath
        Else
        Me.Image56.Picture = "K:\Staff Folders\JinLong\New Folder\default.jpg"
    End If

End Sub

what is wrong with my codes?
there is an error over at
[cod]If [Yield Trend Chart].Value Is Not Null Then[/code]

what i need to do is that when the field [Yield Trend Chart] is empty, then set a default image as the image..
 
There is a good sample in the Sample Databases area
 
MStCyr said:
There is a good sample in the Sample Databases area

i tried the sample and changed the code to
Code:
Private Sub Image56_Click()
Dim DBpath As String
    DBpath = [Yield Trend Chart]
    Me.Image56.Picture = DBpath
    If IsNull(DBpath) Or DBpath = "" Then
    Else
    Me.Image56.Picture = "K:\Staff Folders\JinLong\New Folder\default.jpg"
    
    End If

End Sub

but i still got an error over at
Code:
DBpath = [Yield Trend Chart]

when i clicked on a data with empty field for [Yield Trend Chart]

did i do anything wrong?
 
Kinda, you didn't let us know what the error message was ;)

Helps us to figure it out. are you saying [Yield Trend Chart] is Null?

so If Nz([Yield Trend Chart],"") then

any help? lightray
 
the error shown was

Run-time error '94':
invalid use of null
 
it tried to replace

Code:
If IsNull(DBpath) Or DBpath = "" Then
with
Code:
If Nz([Yield Trend Chart],"") then
but it show

Run-time error '13':
Type mismatch
 
ok solved it...

Code:
Private Sub Image56_Click()
Dim DBpath As String

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

End Sub

thanks for all the help given
 

Users who are viewing this thread

Back
Top Bottom