Results 1 to 7 of 7

Thread: Embedding a file in a Access DB

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2010
    Posts
    4

    Embedding a file in a Access DB

    Hello everyone,
    I new in programming, and I thought I should start with VB6.
    I have an Access DB with a table (Updates) that contains a OLE field (Attachment).
    I need the code to let me insert a file (no matter what type, it can be a picture, an Outlook mail or any other Office document) from within the program, and then to open it from the RecordSet with a double click on a OLE object for example.
    Is that even possible with VB6?
    In case it is, I would appreciate very much some code examples for updating and retrieving the object.
    Thanks in advance to all readers and posters.

  2. #2

  3. #3

    Thread Starter
    New Member
    Join Date
    Nov 2010
    Posts
    4

    Re: Embedding a file in a Access DB

    thanks RB, but I had already checked the links in your signature.
    I was hoping to get a different answer, with a more global code, since I don't see the way to display the "attachment".
    But thanks a lot anyway.

  4. #4
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Embedding a file in a Access DB

    Those samples demonstrate how to save/retrieve file to/from database.
    What you do with your file (any type btw) after retrieving is entirely up to you so I am not quite sure I understand your concern about "displaying the attachment".

  5. #5

    Thread Starter
    New Member
    Join Date
    Nov 2010
    Posts
    4

    Re: Embedding a file in a Access DB

    Well, I printed your code, kept reading it for many minutes, and finally figured out that you were actually creating a temporary file, using a windows API ( I guess), and then loading it on a picture.
    I know, I'm a little slow
    With displaying I mean launching, using the explorer Double Click.
    I suppose all I have to do is Embed the temporary file on a OLE object and a double click will do the rest.
    Thank you again Mr. MVP

  6. #6
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Embedding a file in a Access DB

    You can simulate a double-click on a file (or a right-click followed by "open"/"print"/etc) by using the ShellExecute API.

    For more information about it, see the article How do I open a file/web-page in its default application? from our Classic VB FAQs (in the FAQ forum)

  7. #7

    Thread Starter
    New Member
    Join Date
    Nov 2010
    Posts
    4

    Re: Embedding a file in a Access DB

    Thanks!!! I really appreciate your help!!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width