Question General advice on exporting embedded attachments (1 Viewer)

mzafkismugi

New member
Local time
Today, 11:27
Joined
Jun 4, 2019
Messages
4
Hello,

I have been tasked with extracting attachment from an existing MS Access application. What I know:

  1. The application database is Microsoft SQL Server 2000
  2. Attachments are stored in CONTACT_ITEMS_BUF table
  3. The table itself has columns nr and buf, where buf is the actual file. There are no other columns.
  4. buf column is of type image

I can open the file if I add a button to the form and bind the following procedure:

Code:
Private Sub Command421_Click()
Dim rst As ADODB.Recordset
Dim con As ADODB.Connection
Dim strOLEFrm As String

Set rst = New ADODB.Recordset
Set con = CurrentProject.Connection

If IsFrmOpen("Global_ShowOLE") Then
    If IsFrmOpen("Global_ShowOLE2") Then
        CloseForm "Global_ShowOLE", 2
        strOLEFrm = "Global_ShowOLE"
    Else
        strOLEFrm = "Global_ShowOLE2"
    End If
Else
    strOLEFrm = "Global_ShowOLE"
End If

If Me.chfDocs.Form.RecordsetClone.RecordCount > 0 Then
    rst.Open "SELECT NR FROM v_CONTACT_ITEMS_BUF WHERE buf IS NOT NULL AND NR = " & CStr(Me.chfDocs.Form.NR), con, adOpenDynamic, adLockBatchOptimistic
    If rst.EOF Then
        rst.Close
        rst.Open "SELECT NR,BUF FROM v_CONTACT_ITEMS_BUF WHERE buf IS NOT NULL AND NR = " & CStr(Me.chfDocs.Form.NR), con, adOpenDynamic, adLockBatchOptimistic
    End If
    If Not rst.EOF Then
        DoCmd.OpenForm strOLEFrm, , , , , acHidden
        Forms(strOLEFrm).UniqueTable = "dbo.contact_items_buf"
        Forms(strOLEFrm).RecordSource = "SELECT buf FROM v_CONTACT_ITEMS_BUF WHERE NR = " & CStr(rst(0))
        Forms(strOLEFrm).MAILTEXT.Verb = -2
        'If I comment the following line, the nothing happens when I press the button
        Forms(strOLEFrm).MAILTEXT.Action = 7
    End If
rst.Close
End If

I the following questions:

  1. What the hell is Global_ShowOLE form? I can't find it anywhere in my Access project, yet it somehow works.
  2. I see no foreign keys in the CONTACT_ITEMS_BUF table, but the application can somehow connect the attachments to the actual CONTACT
  3. Is it possible to programatically export the attachments? Please note that there is no filename nor extension stored in the database.
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 19:27
Joined
Jul 9, 2003
Messages
16,280
I note that your question has yet to receive a reply, so I am adding this comment to bump it up the list and give it a second chance.

Cheers Tony
 

Users who are viewing this thread

Top Bottom