Insert a Picture

  • Thread starter Thread starter Vinnie
  • Start date Start date
V

Vinnie

Hi....

I have developed a Form were a user can enter data, I want to include a
field were the user can click in it and insert a picture from a given
folder, but not too sure how to program such filed.

Please help

Regards
 
It would be more advantageous to use an image control on the form and save
the file and path to the table, then use the form's Current event to display
the image. To do that, use the control's picture property:

Sub Form_Current()
Me.ImageCtlName.Picture = Me.txtPath & Me.txtFileName
End Sub

An example of this for both form and report, as well as code to grab all the
images in a folder/subfolder is at:

http://www.datastrat.com/Download/Picture2K.zip
 
Thanks for your reply Arvin

I understand what you mean, but I want the user to be able to navigate
through his/her hard drive and select a picture...For example:

The end user is collecting coins, he enters the related information and
wants to select a coin image from his/her drive and insert it on the
database, I don't want to store hunderds of pictures on the data base, just
the ones the user may need..

Not too sure if I explain myself clearly (Sorry for my english)

I can email and example of what I need...

Regards

Vince
 
Vinnie said:
The end user is collecting coins, he enters the related information and
wants to select a coin image from his/her drive and insert it on the
database, I don't want to store hunderds of pictures on the data base,
just the ones the user may need..

Have you considered using a hyperlink instead of saving the picture in
the database.

My experience has been that inserting pictures, even if only links, take
up a lot of space and you will soon find you database growing and
growing ...

Hyperlinks on the other hard are just short bits of text. A single
click will show the picture.

If you need the picture to open automatically when the form opens then
that is more difficult to achieve.
 
Yes, I understand, and the code to navigate is within:
http://www.datastrat.com/Download/Picture2K.zip

a similar, but more specific example for a single image can be adapted from:

http://www.mvps.org/access/api/api0001.htm

You will need to apply a filter for just image files, which is part of what
I did in my sample.

And you don't need to store hundreds of images. If you put only the images
that the users needs in a single folder, you can use my code to navigate to
that folder and grab them all.

Now add a field to the table to link your data and the picture data, and
have the user fill in that field with the ID from the main record, now use a
query to join the 2 tables and you can display the records with little extra
work.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com
 
Back
Top