Need to convert from embedded documents to linked documents

Richard Cruthirds 61 Reputation points
2021-09-27T13:57:27.317+00:00

I made a rookie mistake by embedding documents into a table instead of linking them. . . luckily, the documents are still in the same location that they were embedded from . . .does anyone have any VBA code that will run through the table and either build another table or add a field in the same table with the filename link so I can delete the embedded documents and revert to a link?

Access Development
Access Development
Access: A family of Microsoft relational database management systems designed for ease of use.Development: The process of researching, productizing, and refining new or existing technologies.
822 questions
0 comments No comments
{count} votes

Accepted answer
  1. DBG 2,301 Reputation points
    2021-09-27T18:54:27.8+00:00

    Okay, I just did a quick test by adding an Attachment field to a table and then running this code. It printed all the filenames I added to the table.

    Public Function ListAttachments() As Boolean
    'thedbguy@gmail.com
    '9/27/2021
    
    Dim db As DAO.Database
    Dim rs As DAO.Recordset
    Dim rs2 As DAO.Recordset2
    
    Set db = CurrentDb()
    Set rs = db.OpenRecordset("Table1")
    
    With rs
        Do While Not .EOF
            Set rs2 = !docs.Value
            Do While Not rs2.EOF
                Debug.Print rs2.FileName
                rs2.MoveNext
            Loop
            rs2.Close
            .MoveNext
        Loop
        .Close
    End With
    
    Set rs2 = Nothing
    Set rs = Nothing
    Set db = Nothing
    
    End Function
    

    Hope that helps...

    0 comments No comments

6 additional answers

Sort by: Most helpful
  1. Richard Cruthirds 61 Reputation points
    2021-09-27T19:33:21.497+00:00

    That should work . . . thanks so much . . .

    0 comments No comments

  2. DBG 2,301 Reputation points
    2021-09-27T19:37:07.84+00:00

    You're welcome. Let us know how it goes. Good luck!

    0 comments No comments