Question : How to create a folder in the file system in run-time

I am using DoCmd.OutputTo acOutputReport to write a report in the file system. It is working, but my logic requires that I must have a folder, otherwise it will not create the file in the path I indicate.

How can I create a folder by default if it doesn't exist?

Thank you in advance.

Answer : How to create a folder in the file system in run-time

This command doesn't create the folder only with the path:
DoCmd.OutputTo acOutputReport, "", acFormatPDF, Path & "\" & FileName, False

who says it does?

what is the string value of your variable path ?
post it here..


or just do this

if right(Path,1)<>"\" then path=path & "\"

'create the folder/s
Call MakeSureDirectoryPathExists(Path)

'create the file
DoCmd.OutputTo acOutputReport, "", acFormatPDF, Path & "\" & FileName, False
Random Solutions  
 
programming4us programming4us