View/Load Access attachment from excel userform

AceandVecky

New Member
Joined
Jun 7, 2019
Messages
7
Good Day.
Please Help me or advise suggestion or Tips on how to load, View or Download an attachment from a selected record in an MS Access table using excel macro.

I can however modify/Add/Delete data in access using an ADODB Connection but i dont have experience in working with attachment. Thanks in advance.
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
@ranman256
yeah thats correct. but what Im trying to achieve is do that using a macro code from Excel. I have an excel userform as a frontend and an access database as the backend.

Thanks
 
Upvote 0
something like :

Code:
Dim rst As ADODB.Recordset
Dim conn As New ADODB.Connection

vTarg = "c:\temp\myFile.jpg"

If Not FileExists(vTarg) Then
'extract photo attachement
sConnStr = "your connection string"
conn.ConnectionString = sConnStr
conn.Open

    '1st rst is the table
sSql = "select * from tInstallDb"
Set rst = conn.Execute(sSql)
'2nd rst is the attachment (rst in a rst)
Set rstChild = rst.Fields(0).Value
rstChild.Fields("FileData").SaveToFile vTarg
End If

Code:
Public Function FileExists(ByVal pvFile) As Boolean
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
FileExists = fso.FileExists(pvFile)
Set fso = Nothing
End Function
 
Upvote 0

Forum statistics

Threads
1,214,905
Messages
6,122,174
Members
449,071
Latest member
cdnMech

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