Avatar of sheng wee
sheng wee
 asked on

Pdf to save under the folder that obtain the same name from Pdf

Hello everyone,

I am having one button to create folder behind the Access
Private Sub Command58_Click()

filename = Ref_Number.Value
MkDir "c:\AccessDatabase\" & filename
MkDir "c:\AccessDatabase\" & filename & "\Commercial"
MkDir "c:\AccessDatabase\" & filename & "\Deployment"
MsgBox ("File has been created successfully")

Now I want a button that can save the Pdf into the folder itself based on the same Ref_Number

Dim filename As String
Dim filepath As String

filename = Me.Ref_Number
filepath = "c:\AccessDatabase\" & filename & ".pdf"
DoCmd.OutputTo acOutputReport, "OrderCustomerReport", acFormatPDF, filepath
MsgBox "Quotation has been saved successfully", vbInformation, "Save confirmed"

What code am I missing out? or What code to input?
Microsoft AccessVBA

Avatar of undefined
Last Comment
sheng wee

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Rey Obrero (Capricorn1)

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
sheng wee

ASKER
Thank you ! How blind of me to forget that one part !
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes