Solved send pdf straigh to folder (1 Viewer)

rainbows

Registered User.
Local time
Today, 00:39
Joined
Apr 21, 2017
Messages
425
1636104751272.png

hi , this is a piece of code someone gladly sent me with the attached form , how can if send a pdf straight to a folder ie if the field "company" is the form "issues list" = PPI-ENGINEERING the send it to folder "c:\users\steve\documents\ppi ." if the company is API -ENGINEERING then send it to "c:\users\steve\documents\api. else if it is apic-capacitors send it to folde "c:\users\steve\documents\apic thanks steve
 

Attachments

  • 1636104947984.png
    1636104947984.png
    270.8 KB · Views: 334

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 15:39
Joined
May 7, 2009
Messages
19,233
add code to the button:

Code:
Private sub cmdAction_Click()
If Syscmd(acSyscmdGetObjectState, acForm, "Issue List")<>0 Then
    If Me.Frame2 = 2 Then
        If Forms![Issue List]![Company] = "PPI-Engineering" Then
                DoCmd.OutputTo acOutputReport,"ReportName",acFormatPDF, "c:\users\steve\documents\ppi\report_name.pdf"
        End If
        If Forms![Issue List]![Company] = "API-Engineering" Then
                DoCmd.OutputTo acOutputReport,"ReportName",acFormatPDF, "c:\users\steve\documents\api\report_name.pdf"
        End If
   End If
End If
End Sub
 
Last edited:

Pat Hartman

Super Moderator
Staff member
Local time
Today, 03:39
Joined
Feb 19, 2002
Messages
43,263
If you make the folder name the same as the company name, you don't need the if statement. You can just concatenate the name. OR, you can put the folder name in the company record and get the short name that way.

Code that hard-codes values such as what arnel posted is seriously poor practice and shortsighted unless you're never going to ever do business with a different company. I know he gave you exactly what you asked for but novices sometimes need guidance rather than code.
 

Users who are viewing this thread

Top Bottom