Hello,
I am generating PDF files using MS Access, using DoCmd.OutputTo command.
Is there any way to add a file attachment to this PDF file, as described here? https://helpx.adobe.com/acrobat/usin...nts-pdfs.html#
Thank you for any tips,
Tomas
Hello,
I am generating PDF files using MS Access, using DoCmd.OutputTo command.
Is there any way to add a file attachment to this PDF file, as described here? https://helpx.adobe.com/acrobat/usin...nts-pdfs.html#
Thank you for any tips,
Tomas
i would avoid using file attachments as they can fill up your db fast.
instead what about storing the PATH of the pdf in a field, located on server,
then you can open it via this:
paste this code into a module
its usage is: OpenNativeApp txtBox
Code:#If Win64 Then 'Public Dclare PtrSafe Function Private Declare PtrSafe Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpszOp As String, ByVal lpszFile As String, ByVal lpszParams As String, ByVal lpszDir As String, ByVal FsShowCmd As Long) As Long Private Declare PtrSafe Function GetDesktopWindow Lib "user32" () As Long #else Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpszOp As String, ByVal lpszFile As String, ByVal lpszParams As String, ByVal lpszDir As String, ByVal FsShowCmd As Long) As Long Private Declare Function GetDesktopWindow Lib "user32" () As Long #End If Const SW_SHOWNORMAL = 1 Const SE_ERR_FNF = 2& Const SE_ERR_PNF = 3& Const SE_ERR_ACCESSDENIED = 5& Const SE_ERR_OOM = 8& Const SE_ERR_DLLNOTFOUND = 32& Const SE_ERR_SHARE = 26& Const SE_ERR_ASSOCINCOMPLETE = 27& Const SE_ERR_DDETIMEOUT = 28& Const SE_ERR_DDEFAIL = 29& Const SE_ERR_DDEBUSY = 30& Const SE_ERR_NOASSOC = 31& Const ERROR_BAD_FORMAT = 11& Public Sub OpenNativeApp(ByVal psDocName As String) Dim r As Long, msg As String r = StartDoc(psDocName) If r <= 32 Then 'There was an error Select Case r Case SE_ERR_FNF msg = "File not found" Case SE_ERR_PNF msg = "Path not found" Case SE_ERR_ACCESSDENIED msg = "Access denied" Case SE_ERR_OOM msg = "Out of memory" Case SE_ERR_DLLNOTFOUND msg = "DLL not found" Case SE_ERR_SHARE msg = "A sharing violation occurred" Case SE_ERR_ASSOCINCOMPLETE msg = "Incomplete or invalid file association" Case SE_ERR_DDETIMEOUT msg = "DDE Time out" Case SE_ERR_DDEFAIL msg = "DDE transaction failed" Case SE_ERR_DDEBUSY msg = "DDE busy" Case SE_ERR_NOASSOC msg = "No association for file extension" Case ERROR_BAD_FORMAT msg = "Invalid EXE file or error in EXE image" Case Else msg = "Unknown error" End Select ' MsgBox msg End If End Sub Private Function StartDoc(psDocName As String) As Long Dim Scr_hDC As Long Scr_hDC = GetDesktopWindow() StartDoc = ShellExecute(Scr_hDC, "Open", psDocName, "", "C:\", SW_SHOWNORMAL) End Function
I don't think you can do that without an Adobe Pro installation.
DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
Please use the star below the post to say thanks if we have helped !
↓↓ It's down here ↓↓
Editing PDF requires features in Adobe Pro that Reader does not have. VBA programming to manipulate PDF requires install of Adobe Pro.
There are 3rd-party online PDF editors.
Might be able to open PDF in Word and do some editing, although I doubt attaching file will be available.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Thanks, I do have Adobe Pro though. In my country, there is this convention for invoices and accounting, that all PDF invoices have this file attached to them (ISDOC file), which then helps accounting software to process the invoices.
I want to generate invoices and attach this ISDOC file to them (which I will also generate).
Could you just make a PDF of this ISDOC file and make that PDF the last page of the INVOICE PDF? I can show you code to combine PDF files. I have no idea what the code would be for attaching file and setting link in PDF. I no longer have Adobe Pro so can't explore this.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Unfortunately not. ISDOC is something like an XML file. Accounting software goes in and digs data about the invoice from it.
From quick research it seems this is something that is done with special software and not with Adobe and probably not with Access. I did come across links that indicate it can be done with Word but I didn't read them. I suggest doing a search such as "how to attach isdoc file to pdf" or add "with Access" to that at the end.
The more we hear silence, the more we begin to think about our value in this universe.
Paraphrase of Professor Brian Cox.