A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

If then Statement for Picture



 
 
Thread Tools Display Modes
  #1  
Old April 23rd, 2008, 10:37 PM posted to microsoft.public.access.forms
Brett
external usenet poster
 
Posts: 151
Default If then Statement for Picture

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!!
  #2  
Old April 24th, 2008, 12:16 AM posted to microsoft.public.access.forms
fredg
external usenet poster
 
Posts: 4,386
Default If then Statement for Picture

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
  #3  
Old April 24th, 2008, 04:26 PM posted to microsoft.public.access.forms
Brett
external usenet poster
 
Posts: 151
Default If then Statement for Picture

Thank you, Fred

"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

  #4  
Old April 24th, 2008, 04:46 PM posted to microsoft.public.access.forms
Brett
external usenet poster
 
Posts: 151
Default If then Statement for Picture

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

  #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
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:29 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.