photos

zim

New Member
Joined
Jul 6, 2002
Messages
41
I want to create a "rogues gallery" with info and a photo of each of my customers. Can anyone explain step by step please how to do this so that my photos eg jpeg1 , jpeg2, jpeg 3 etc show on the correct form entry.
Thanks :biggrin:
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
I think that the easiest way would be to open your table in Design View, add a field of type OLE Object, add your pictures there (I think they need to be BMP files), then add the field to your form.

To add the pictures, open the table in normal view, then click on the field that you added (in the record that you want to add a picture for), and go to Insert-Object. Choose "from file", and browse for your picture. You'll have to repeat this for each record. I'm not sure how to do this in a more efficient way - sorry.

-Russell
 
Upvote 0
Forgive me for not thanking you both earlier - in fact I think it may take me a little time to properly explore your solutions. Thank you (y)
 
Upvote 0
OK- stuck again
In the explanation of the pic handling reference (above) it tells me to
3)Programmatically set the .Picture property of an Image Box to the appropriate file in the On Current event of the form
How do I do this bit please?
(Step by step idiot guide) :rolleyes:
 
Upvote 0
in the sample db
The name of the picture is stored in the table tblPictures
In the code behind frmPictures
Code:
Private Sub Form_Activate()
    'find the path of the current database
    'which is where the jpegs are stored
    Set db = CurrentDb
    filename = db.Name
    pathname = Mid(filename, 1, Len(filename) - Len(Dir(filename)))
End Sub
This is finding the path to your pictures assuming that they are in the same folder as your db. You could hard code this path.

Code:
Private Sub Form_Current()
On Error GoTo Err_cmdClose_Click

    'set the picture path
    Me.ImgStock.Picture = pathname & Me.txtStockGraph
    
Exit_cmdClose_Click:
    Exit Sub

Err_cmdClose_Click:
    If Err.Number = 2220 Then 'can't find the file
        Resume Next
    Else
        MsgBox Err.Description
        Resume Exit_cmdClose_Click
    End If
End Sub
in this bit of code , Me.ImgStock.Picture = pathname & Me.txtStockGraph does all of the work
ImgStock is the name of the image control on the form
TxtStockGraph is the name of the field that has the name of the picture file in it.

Hope that makes more sense.

peter
 
Upvote 0
Hi,

Thanks for the excellent help in getting photo's "into" a database without actually loading them. I downloaded the example database from:

http://www.database-wizards.com/access_97_sample_library.htm#P

With a little playing around I incorporated it into my own existing database which eventually will have thousands of photos. The database was growing larger by the second without this help.

I still need a little help however, and that is in the form that i am using. I have a main form with a continuous subform showing a picture of the equipment with all relevant data. Each grouping of photos refers to a particular company. The subform is linked to the main form via a company ID.

My problem is that the subform will show all the records but will only show one picture (the same) on all records.

If I make the subform single view it works as it is supposed to.

Below is the code that I have used to date with AGFE being the equipment table:

Option Compare Database
Option Explicit
Dim filename As String, pathname As String
Dim db As Database


Private Sub Form_Activate()
'find the path of the current database
'which is where the jpegs are stored
Set db = CurrentDb
filename = db.Name
pathname = Mid(filename, 1, Len(filename) - Len(Dir(filename)))
End Sub

Private Sub Form_Current()
On Error GoTo Err_cmdClose_Click

'set the picture path
Me.ImgAGFE.Picture = pathname & Me.Photo

Exit_cmdClose_Click:
Exit Sub

Err_cmdClose_Click:
If Err.Number = 2220 Then 'can't find the file
Resume Next
Else
MsgBox Err.Description
Resume Exit_cmdClose_Click
End If
End Sub

Private Sub PHOTO_AfterUpdate()
Me.RecordsetClone.FindFirst "[AGFEID] = " & Me!AGFEID
Me.Bookmark = Me.RecordsetClone.Bookmark
End Sub


Private Sub cmdClose_Click()
On Error GoTo Err_cmdClose_Click


DoCmd.Close

Exit_cmdClose_Click:
Exit Sub

Err_cmdClose_Click:
MsgBox Err.Description
Resume Exit_cmdClose_Click

End Sub

I would be very appreciative if someone could point me in the right direction for getting each individual picture to show on its particular record.

:biggrin:

Regards

Gazza
 
Upvote 0

Forum statistics

Threads
1,221,631
Messages
6,160,942
Members
451,679
Latest member
BlueH1

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top