Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Link or embed photos into Access - for video frame retrieval

Status
Not open for further replies.

davegmail

IS-IT--Management
Jun 4, 2006
186
0
0
US
Link or embed photos into Access - for video frame retrieval

Can I do this for indexing many video tapes? I have so far used WordPad with this data:

1. Tape number & date
2. Topic - (birthday party)
3. Video Frame as a JPG file

Pros - can search *.rtf files for topic & tape, but very combersonm.

Cons - very awkward & clunky.

I have also considered Excel vs Access, but I would like to index the Tapes in various ways - by Date, Topic, etc but also retrieve the image associated with the Tape.

Is this reasonable?

Thanks, Dave
 
Yes Access is ideal for this but...

Prior to Access 2007 embedding OLE objects caused your database to bloat. The size of the database would increase around 10 times the size of each OLE object. 2007 seems to have fixed that problem.
Prior to 2007 most people placed the files in a directory and saved the file name or file path in the database record. Using a little code you can then display the image from the file

Below is some code that will do all of the work for you. I did not put a lot of bells and whistles but if you follow the instructions the only thing you have to do is past the code into a CLASS module and copy some other code onto your form or report. On your form or report you will need to save a field with the path and file name and have a control to show the picture.
 
This will show how to link the photo or image storing only the path to file in the database

thread702-289543
 
Sorry I forgot to post the code:

Code:
'
'   Module Nam: PictureFromFile
'   Devloped by: Maj P
'   Purpose: This classs creates funtionality so that a form with an image box
'and a control with a path name, will automatically show the image whose path is contained
'in the control.  The form must be in single form view, the report must force a page break after the
'detail section so that there is one record per page. This does not work in a continous
'view.
'
'   To Use: Drop the below code into a CLASS module and name the
'   Class module "PictureFromFile".  Then in a
'   form/report do the following:
'
'  FORM / REPORT CODE
'
'*********************************************************************
'  Public objPictureFromFile As PictureFromFile
'  Private Sub Form_Open(Cancel As Integer)
'     Set objPictureFromFile = New PictureFromFile
'     (for a form) Set objPictureFromFile.PictureForm = Me
'     (for a Report) Set objPictureFromFile.PictureReport = Me
'     Set objPictureFromFile.PictureControl = Me.imgCntrlOne
'     Set objPictureFromFile.PictureNameControl = Me.txtBxPicPath
'   End Sub
'**********************************************************************
'END FORM/REPORT CODE
'
'
'
'CLASS CODE
Option Compare Database
Option Explicit

Private mPictureNameControl As TextBox
Private mImagePath As String
Private mImageControl As Image
Private WithEvents mForm As Access.Form
Private WithEvents mReport As Access.Report
Public Property Set PictureNameControl(thePictureNameControl As TextBox)
  Set mPictureNameControl = thePictureNameControl
 End Property
Public Property Set PictureControl(theControl As Image)
  Set mImageControl = theControl
End Property
Public Property Set PictureForm(theForm As Access.Form)
  On Error GoTo HandleError
  Set mForm = theForm
  mForm.OnCurrent = "[Event Procedure]"
  Exit Property
HandleError:
  MsgBox Err.Number & "  " & Err.Description
End Property
Public Property Set PictureReport(theReport As Access.Report)
  Set mReport = theReport
  mReport.OnPage = "[Event Procedure]"
  mReport.OnActivate = "[Event Procedure]"
End Property
Private Sub subLoadImage()
   Dim strImagePathAndFile As String
   Dim objFileSystem As Object
   Dim connection As String
   Set objFileSystem = CreateObject("Scripting.FileSystemObject")
   On Error GoTo PictureNotAvailable
   strImagePathAndFile = Nz(mPictureNameControl.Value, "")
   mImageControl.Visible = True
   If objFileSystem.FileExists(strImagePathAndFile) Then
      mImageControl.Picture = strImagePathAndFile
      mImageControl.Visible = True
      mImagePath = strImagePathAndFile
   Else
      mImageControl.Picture = ""
      mImageControl.Visible = False
   End If
   Exit Sub
PictureNotAvailable:
   MsgBox Err.Number & "  " & Err.Description & Chr(13) & "In PictureFromFile Class"
End Sub
Private Sub mForm_Current()
  Call subLoadImage
End Sub
Private Sub mReport_Activate()
  Call subLoadImage
End Sub
Private Sub mReport_Page()
  Call subLoadImage
End Sub
Public Property Get ImagePath() As String
  ImagePath = mImagePath
End Property

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top