View Single Post
  #5  
Old April 24th, 2008, 05:38 PM posted to microsoft.public.access.forms
fredg
external usenet poster
 
Posts: 4,386
Default If then Statement for Picture

On Thu, 24 Apr 2008 08:46:01 -0700, brett wrote:

One more thing, Fred. I understand the code, but where do i go to set the
image control?
Thank you

"fredg" wrote:

On Wed, 23 Apr 2008 14:37:01 -0700, brett wrote:

Hi guys,
I was wondering if you want to insert a bound picture but when there isnt a
picture and the value isnull, you want the text to read "No Picture" what is
the statement you can use:

I currently was thinking:
Private Sub Photo_Updated(Code As Integer)

If IsNull(Me(PHOTO)) = "" Then MsgBox "No Photo" Else Photo_Updated
End If

End Sub

Thank you!!


What is Photo? The name of a field in your table that holds the name
of the picture, io.e. "Flowers.jpg"?

Use an Image control to show the pictures.
You'll probably have to enter a picture name.
Save the control.
Then, delete the Picture name. Access will question it. Click Yes.

Add a label over the center of the Image control.
Set it's Caption property to:
"No Picture Available"
Set it's visible property to No.

Use the Form's Current event:
If IsNull(Me.[Photo]) then
Me.ImageControlName.Visible = false
Me.labelName.Visible = True
Else
Me.ImageControlName.Picture = "C:\PathToPicture\" & [Photo]
Me.ImageControlName.Visible = True
Me.labelName.Visible = False

End If


--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail


Regarding: where do i go to set the image control?
Do you mean to add an Image control to your form?
In form design view, click on the ToolBox toolbutton. Find the Image
control. Click on it. Move your cursor onto your form. Click. Navigate
to, and select any picture when the wizard opens. Click OK.
Then delete the picture property as I mentioned in the previous post.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail