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

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
@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,223,911
Messages
6,175,333
Members
452,636
Latest member
laura12345

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