Do you want all files in the same folder? It is not required to save full folder path into table. That can be concatenated in code when it is needed, see example.
Does each record have multiple attachments? If so, create a new table to hold the PDF names. There will be a record for each file. I used table named PDFs with fields ID_FK and FileName. If you are positive there is only one file per record, then code can be modified to save the filename into original table or can fix later outside this process with an UPDATE action.
Using the referenced links as guide (which show everything you need for export from hidden multi-value field table), here is modified code. It uses static folder path. Modify folder path and SQL statements to accommodate your design. I have no idea how long this will take to export thousands of files. Should probably use a local folder on your machine then copy folder to server. When export is successful, can delete the attachments field.
Place code in a general module. Position cursor anywhere in code, click Run from VBA editor menu.
Code:
Public Sub SaveAttToFile()
On Error GoTo SubError
Dim rsParent As DAO.Recordset
Dim rsAttachment As DAO.Recordset2
Dim strFileName As String, strFolderPath As String
Dim db As DAO.Database
Set db = CurrentDb
strFolderPath = "C:\PDFs\"
Set rsParent = db.OpenRecordset("SELECT ID, Test FROM Rates WHERE Not Test.FileName Is Null", dbOpenSnapshot)
Do While Not rsParent.EOF
Set rsAttachment = rsParent!Test.Value
Do While Not rsAttachment.EOF
strFileName = rsAttachment!FileName
'make sure this file doesn't already exist!
If Dir(strFolderPath & strFileName) <> "" Then
FileSystem.Kill strFolderPath & strFileName
End If
'Save the document to a file and record in PDFs table
rsAttachment!FileData.SaveToFile strFolderPath & strFileName
db.Execute "INSERT INTO PDFs(ID_FK, FileName) VALUES(" & rsParent!ID & ",'" & strFileName & "')"
rsAttachment.MoveNext
Loop
rsAttachment.Close
rsParent.MoveNext
Loop
SubExit:
On Error Resume Next
If Not rsAttachment Is Nothing Then
rsAttachment.Close
Set rsAttachment = Nothing
End If
If Not rsParent Is Nothing Then
rsParent.Close
Set rsParent = Nothing
End If
If Not db Is Nothing Then
db.Close
Set db = Nothing
End If
Exit Sub
SubError:
MsgBox "Error Number: " & Err.Number & " = " & Err.Description, vbCritical + vbOKOnly, _
"An error occurred"
GoTo SubExit
End Sub
If you need more help, provide details of table and field names. Or attach a database with a reduced set of records, 2 records with embedded attachments should be enough. Follow instructions at bottom of my post.