Images and forms

  • Thread starter Thread starter Clive
  • Start date Start date
C

Clive

Can some one help me! I am a new to access and Vb. I embarked apon this
project as a learning excises. I have run into one problem that I have
not been able to solve.

My form contains a number of images and I use the following to show them

Private Sub Form_Current()
On Error Resume Next
Me![ImageFrame].Picture = Me![ImagePath]
End Sub

Ok nothing new with this as it seams to be the recommended way.

unfortunately there is one problem if a record does not contain any
images then the last image to be viewed is left displayed.

How can I detect if ImagePath contains "" and ever hide the ImageFrame
or display a default image.

Clive
 
You can try this way:

On Error Resume Next
if Nz(Me![ImagePath],"") <> "" then
Me![ImageFrame].Picture = Me![ImagePath]
Me![ImageFrame].visible = True
else
Me![ImageFrame].Picture = ""
Me![ImageFrame].visible = false
end if

Read help for description of NZ function

Marius
 
Thanks Marius,
Your code worked well :)
Clive

Marius said:
You can try this way:

On Error Resume Next
if Nz(Me![ImagePath],"") <> "" then
Me![ImageFrame].Picture = Me![ImagePath]
Me![ImageFrame].visible = True
else
Me![ImageFrame].Picture = ""
Me![ImageFrame].visible = false
end if

Read help for description of NZ function

Marius

Can some one help me! I am a new to access and Vb. I embarked apon this
project as a learning excises. I have run into one problem that I have
not been able to solve.

My form contains a number of images and I use the following to show them

Private Sub Form_Current()
On Error Resume Next
Me![ImageFrame].Picture = Me![ImagePath]
End Sub

Ok nothing new with this as it seams to be the recommended way.

unfortunately there is one problem if a record does not contain any
images then the last image to be viewed is left displayed.

How can I detect if ImagePath contains "" and ever hide the ImageFrame
or display a default image.

Clive
 
Back
Top