Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Embed OLE-File when given a path to it

Status
Not open for further replies.

spitzmuller

Programmer
May 7, 2004
98
CH
Hi there

I would like to embed files into an access-db (links are fine but the original files are likely to be moved quite often...)

How can I, given the path to a file, embed it in an access table using VBA?

I searched the forums quite a while but didn't find a decent answer... so if anyone could point me in the right direction.

Thanks and Greets Simon
 
Thanks, will try. But why does someting like that

Code:
Private Sub AddDocument_Click()
    Dim path As String
    Dim rs As New Recordset
    '1) let user pick a file
    path = PickFile
    If path = "" Then Exit Sub
    '2) save the file into database and show edit window
    rs.Open "documents", CurrentProject.Connection, adOpenDynamic, adLockOptimistic
    rs.AddNew
    rs("projectID") = Me.ProjectID
    rs("document").CreateEmbed "path"
    rs.Update
End Sub

not work? The document-field is of type OLE. Can something like this be done in VBA?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top