picture

  • Thread starter Mohammad Ali Sadri
  • Start date
M

Mohammad Ali Sadri

How can I insert a picture in a form, just by putting its address in the
related table?
How can I do it with or without writing a code?
 
F

fredg

How can I insert a picture in a form, just by putting its address in the
related table?
How can I do it with or without writing a code?

Store the picture in a folder on your hard drive.

Add a text Field to your table. Name it [PictureName]
Store the name of the picture and it's extension in your table, i.e.
"FarmHouse.jpg"

Add an Image control to your form.
Leave the Image control's Picture property blank. (You may need to
select any picture when adding the control. After the control has been
added and saved, delete the picture. Click OK when prompted about
deleting the picture.)

Code the Form's Currrent event:

If Not IsNull(Me.[PictureName]) Then
Me.ImageName.Picture = "c:\FolderName\" & [PictureName]
Me.ImageName.Visible = True
Else
Me.ImageName.Picture = False
End If

Only records that contain a picture will show on the form.
 
M

Mohammad Ali Sadri

fredg said:
How can I insert a picture in a form, just by putting its address in the
related table?
How can I do it with or without writing a code?

Store the picture in a folder on your hard drive.

Add a text Field to your table. Name it [PictureName]
Store the name of the picture and it's extension in your table, i.e.
"FarmHouse.jpg"

Add an Image control to your form.
Leave the Image control's Picture property blank. (You may need to
select any picture when adding the control. After the control has been
added and saved, delete the picture. Click OK when prompted about
deleting the picture.)

Code the Form's Currrent event:

If Not IsNull(Me.[PictureName]) Then
Me.ImageName.Picture = "c:\FolderName\" & [PictureName]
Me.ImageName.Visible = True
Else
Me.ImageName.Picture = False
End If

Only records that contain a picture will show on the form.
And How can I insert Picture without writing code?
 
J

J_Goddard via AccessMonster.com

Only records that contain a picture will show on the form.

Not true. Your code just makes the control containing the picture visible or
not. It does not apply a filter to the data - all records will still be seen,
with or without a picture.

John


How can I insert a picture in a form, just by putting its address in the
related table?
How can I do it with or without writing a code?

Store the picture in a folder on your hard drive.

Add a text Field to your table. Name it [PictureName]
Store the name of the picture and it's extension in your table, i.e.
"FarmHouse.jpg"

Add an Image control to your form.
Leave the Image control's Picture property blank. (You may need to
select any picture when adding the control. After the control has been
added and saved, delete the picture. Click OK when prompted about
deleting the picture.)

Code the Form's Currrent event:

If Not IsNull(Me.[PictureName]) Then
Me.ImageName.Picture = "c:\FolderName\" & [PictureName]
Me.ImageName.Visible = True
Else
Me.ImageName.Picture = False
End If

Only records that contain a picture will show on the form.
 
J

J_Goddard via AccessMonster.com

If the picture name is part of the data in your table, you can't - you need
code - the example shown by fredg is typical of what you need.

John

[quoted text clipped - 22 lines]
Only records that contain a picture will show on the form.

And How can I insert Picture without writing code?
 
F

fredg

Only records that contain a picture will show on the form.

Not true. Your code just makes the control containing the picture visible or
not. It does not apply a filter to the data - all records will still be seen,
with or without a picture.

John
How can I insert a picture in a form, just by putting its address in the
related table?
How can I do it with or without writing a code?

Store the picture in a folder on your hard drive.

Add a text Field to your table. Name it [PictureName]
Store the name of the picture and it's extension in your table, i.e.
"FarmHouse.jpg"

Add an Image control to your form.
Leave the Image control's Picture property blank. (You may need to
select any picture when adding the control. After the control has been
added and saved, delete the picture. Click OK when prompted about
deleting the picture.)

Code the Form's Currrent event:

If Not IsNull(Me.[PictureName]) Then
Me.ImageName.Picture = "c:\FolderName\" & [PictureName]
Me.ImageName.Visible = True
Else
Me.ImageName.Picture = False
End If

Only records that contain a picture will show on the form.

John,
Thanks for mentioning this.
After re-reading that line I can see that I should have written:

"Only where a record contains a picture name will a picture show."
 
Top