Images and forms

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
 
M

Marius Kavaliauskas

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
 
C

Clive

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top