Results 1 to 4 of 4
  1. #1
    snsmith is offline Novice
    Windows 10 Access 2016
    Join Date
    Jun 2019
    Posts
    23

    Attach PDF that were previously made and stored

    I am a novice still when it comes to some of the programming and got help from this group before so I'm hoping you can help me again. In my previous requests the group helped me create my invoices and store them in a shared folder. It's been working perfectly! I've built the code so I can send reminders to those that are still outstanding but I've had to attach the previously made pdfs by hand. In the beginning this isn't a huge deal but as you continue to get outstanding invoices this practice isn't something I want to keep doing. I'd love to be able to program so it just goes into the location where they are stored and attach to the reminder emails. I'm sure there are ways and I'm just not able to complete it.

    I don't know if you need to see all the components but this is where I am attempting to identify the invoice:
    __________________________________________________ _______________________________________________
    Private Function AddInvoicePDF(sInvoice As String, StudyID As Long) As String
    Dim AddInvoice As String
    Dim Criteria As String
    AddInvoice = "M:\Programs\0.BillingReportsandInvoices\0.Invoice sPendingApproval" & sInvoice & ".pdf"
    Criteria = "[Study ID]=" & StudyID
    End Function
    __________________________________________________ _______________________________________________
    And here is where I was trying to attach to the email:
    __________________________________________________ _______________________________________________



    outMail.Attachments.Add AddInvoicePDF(rs("[Invoice #]"), rs("[Study ID]"))
    __________________________________________________ _______________________________________________

    Now if I over over the rs("[Invoice #]") and rs("[Study ID]") the Invoice# is showing (without the .pdf indicator for a file name) and the Study ID is showing properly. However it's throwing a "Path does not exist. Verify the path is correct" error. Since these invoices can cross multiple criteria's I do not wish to have it create a new invoice each time but pull from the original location. Is there a way that I can accomplish what I want?

    Thanks!
    Sandra


  2. #2
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2013 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,101
    Sandra,
    Your code is a bit off (the function does not really return a value as it should and the path in the second piece is incomplete as it is missing the "M:\Programs...." and the ".pdf" extension). And you do not show us how is the StudyId incorporated in the file name. That should be fairly easy to accomplish if you break down the requirements in smaller steps. You need to declare a string variable to hold the path to the existing invoice (pdf) file. Now you start with the path you have in the function above and concatenate the invoice and study id:
    Code:
    Dim sInvoice as string
    sInvoice = "M:\Programs\0.BillingReportsandInvoices\0.InvoicesPendingApproval" & rs("[Invoice #] &  "_" &  rs("[Study ID]") &  ".pdf" 'assuming PDFs are named InvoiceNumber_StudyID.pdf
    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  3. #3
    snsmith is offline Novice
    Windows 10 Access 2016
    Join Date
    Jun 2019
    Posts
    23
    Thank you Vlad. This worked perfectly! You actually helped on my other coding and I really appreciate the help.
    Sandra

  4. #4
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2013 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,101

    You're very welcome, good luck with your project!

    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 02-11-2019, 08:54 PM
  2. Checking to see if previously used.
    By Thompyt in forum Programming
    Replies: 4
    Last Post: 12-27-2016, 10:37 AM
  3. Download attachment previously uploaded
    By libraccess in forum Misc
    Replies: 0
    Last Post: 09-12-2013, 02:01 AM
  4. Replies: 12
    Last Post: 02-01-2013, 02:25 PM
  5. Remembering previously enetered data
    By tarhim47 in forum Forms
    Replies: 5
    Last Post: 05-03-2011, 04:53 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums