Consulting

Results 1 to 8 of 8

Thread: Adding PDF's to table...

  1. #1

    Adding PDF's to table...

    Ok, I have a user form thats used to add data to a table (obviously!) but I have been asked is it possible to be able to attach a PDF file via the user form so that it is also added to the table??

    Hope you can help as it's driving me

  2. #2
    VBAX Master stanl's Avatar
    Joined
    Jan 2005
    Posts
    1,141
    Location
    Not really sure what you are asking. But if you mean have a field in your table that can contain a PDF file, the answer is yes. Define the field as a binary/OLE Object and use an ADODB.Stream Object to insert a selected PDF into the field. If you mean be able to display the PDF within an Access form, I'm not so sure - probably requires full version of Adobe, whereas with the other method you can just export out of the field to a file and use ShellExecute().

    .02
    Stan

  3. #3
    Hi Stan,

    I'm not particulary wanting to view the PDF in the user form, I can do that with a report, what I would like is to have something on the user form to enable me to add a PDF to a table field as easily as a text box allows me to add text to a field.

    You mentioned, ADODB.Stream Object to insert a selected PDF into the field, could you expand on this please?

    Does that make anymore sense?? I hope so !! Sorry my previous ramble didn't!!

  4. #4
    VBAX Master stanl's Avatar
    Joined
    Jan 2005
    Posts
    1,141
    Location
    Quote Originally Posted by BexleyManor
    I'm not particulary wanting to view the PDF in the user form, I can do that with a report,
    Either way, you're talking about an embedded link, whereas the Stream will insert the entire PDF document as Binary. However, I use Streams a lot and normally include a 'Button' on my form which says "Click To Add" [PDF/XLS/XML/JPEG... whatever] - then I process the click event by popping up the Windows common control with a filemask, verify a file selected then something like

    'assume file selected is cPDF
    'assume Access Field is Binary/OLE type named MyPDF
    S = CreateObject("ADODB.Stream")
    S.Type = 1 'binary stream
    S.Open()
    S.LoadFromFile(cPDF)
    oRS.Fields("MyPDF").Value = S.Read(-1)
    S.Close()
    But I am still confused over how you want the file stored as opposed to how it is displayed. Stan

  5. #5
    I never embed files. I grab the file and save the link to a table. I use the PDF activeX control to them load the file. If this is what you want to do, let me know and I'll help.

    Bones

  6. #6
    Hi Bones, I got dragged away on something else in the office so this is my first chance back at this topic.

    Yes, what you suggest sound interesting and I presume less 'database swelling' than piling them into a table.

    I'd love to hear what you suggest, sounds very interesting.

  7. #7
    I'll put together a sample for you. Giveme a day or two ok.

    Bones

  8. #8
    make a folder call "images" in the same folder where the database is.

    take a look a this. Any question, just ask.
    Last edited by boneKrusher; 06-03-2006 at 05:02 AM.

Posting Permissions

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