troubleshooting Question

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

Avatar of sheng wee
sheng wee asked on
Microsoft AccessVBA
2 Comments1 Solution77 ViewsLast Modified:
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?
Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros