Send files to a Newly created folder

  • Thread starter Thread starter Lamar
  • Start date Start date
L

Lamar

A user hits a cmd button then I want Access to create a
new folder and then output files to the newly created
folder.

Here is the code to create the new folder.
'Creates new folder
MkDir "C:\HousAuth\" & Format(Now, "mmmdyyhhnn") & Left
(cmbHA, 3) & Left(cmbESDStaff, 3)

How do I output the files to the newly created folder?
The issue is you can not give a specific path because
everytime the cmd button is hit then Access creates new
folder.

The file would have to sent to: "C:\HousAuth\" & Format
(Now, "mmmdyyhhnn") & Left(cmbHA, 3) & Left(cmbESDStaff,
3) but it does not work.

the name changes.

Thank you very much.
 
sub Test()
dim str as string

str = "C:\HousAuth\" & Format(Now, "mmmdyyhhnn") & _
Left(cmbHA, 3) & Left(cmbESDStaff, 3)

mkdir str

<<<Use the str variable to specify the output folder in your code>>>

End Sub
 
Lamar:

Why not create a simple string variable to hold the time information so that
its available when you want to reuse it to access the direcotry as in:

Dim strDT$, strDir$

strDT = Format(Now, "mmmdyyhhnn")
strDir = "C:\HousAuth\" & strDT & _
Left (cmbHA, 3) & Left(cmbESDStaff, 3)

Then you can use strDir as the basis for any file operations.
 
Back
Top