Save attachments from query

fred90

New member
Local time
Yesterday, 19:08
Joined
Jan 25, 2015
Messages
5
The code works only for tables and not query. Can someone tell me what I have to change in my code?:
Code:
Dim dbs As DAO.Database
Dim rsQuery As DAO.Recordset
 
Set dbs = CurrentDb
Set rsQuery = dbs.OpenRecordset("myQuery")
 
Set rsImage = rsQuery.Fields("Images").Value
 
While Not rsImage.EOF
    rsImage.Fields("FileData").SaveToFile "C:\Users\myName\Desktop\"
    rsImage.MoveNext
Wend
 
What is rsImage? Your naming convention suggests it might be a recordset yet you try to set it to a single value (the value of the [Images] field in the current record of the rsQuery recordset)? How have you declared it? And how is it meant to have a field called [FileData] when it has been set in this manner?
 
I found the problem. I have to add another loop.
access-programmers.co.uk/forums/showthread.php?t=228146
 

Users who are viewing this thread

Back
Top Bottom