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:
I can open the file if I add a button to the form and bind the following procedure:
I the following questions:
I have been tasked with extracting attachment from an existing MS Access application. What I know:
- The application database is Microsoft SQL Server 2000
- Attachments are stored in CONTACT_ITEMS_BUF table
- The table itself has columns nr and buf, where buf is the actual file. There are no other columns.
- 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:
- What the hell is Global_ShowOLE form? I can't find it anywhere in my Access project, yet it somehow works.
- I see no foreign keys in the CONTACT_ITEMS_BUF table, but the application can somehow connect the attachments to the actual CONTACT
- Is it possible to programatically export the attachments? Please note that there is no filename nor extension stored in the database.