Tying Images to a Database

  • Thread starter Thread starter jprescottjr
  • Start date Start date
J

jprescottjr

Guest
How would you tie tiff images to an access database. for example. if I have a tiff image of an invoice, i would want the customer to be able to search for an invoice using information about the image, like invoice #, cutomer #, purchase price, etc.
 
I have done something similar in my database - I have a text box called tctElectronic that contains the path of a file and the filename. When the user double clicks on it the file is opened:

Code:
Private Sub txtElectronicCopy_DblClick(Cancel As Integer)
    'Opens the drawing specified in the Electronic copy textbox
    If Not IsNull(txtElectronicCopy.Value) Or txtElectronicCopy.Value <> "" Then
        OpenFile (txtElectronicCopy.Value)
    End If
End Sub


Here is the function that opens the file - this is code I found on this site written by Ghudson.

Code:
Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

Public Function OpenFile(sFileName As String)
On Error GoTo Err_OpenFile
    
    OpenFile = ShellExecute(Application.hWndAccessApp, "Open", sFileName, "", "C:\", 1)
Exit_OpenFile:
    Exit Function

Err_OpenFile:
    MsgBox Err.Number & " - " & Err.Description
    Resume Exit_OpenFile

End Function

The other field in your record can store the other info - invoice num etc
 
The question is whether that invoice number, customer number, or other data is available other than through the image. If it isn't, you cannot do the search. This is because Access can display a .TIF but cannot decompose a .TIF into component text too easily.

There is no interface that backwards-analyzes image data in a .TIF unless you have a callable interface to an application object (read .DLL or .OCX) that can do the conversion. Offhand, I don't know of one. But then again, I'm a bit sequestered sometimes.
 

Users who are viewing this thread

Back
Top Bottom