Automating Create New Folder

E

Ed

Hi: Using Access 2002 windows XP pro
Any way to create a new folder from Access and name it from the data in a
field.
I would like to use a macro if possible. Thanks, Ed
 
P

Peter Doering

Hi: Using Access 2002 windows XP pro
Any way to create a new folder from Access and name it from the data in a
field.
I would like to use a macro if possible. Thanks, Ed

In VBA the command is: MkDir "MYDIR" (see help).

In a macro I don't know. But if you want to take the name from a field it's
definitely easier in the form's class module.

HTH - Peter
 
K

Ken Snell

A macro won't do this directly. Use VBA code (you can call a function from a
macro, and have that function run the VBA code).
 
E

Ed

Thanks, Any simple examples out there?

Ken Snell said:
A macro won't do this directly. Use VBA code (you can call a function from a
macro, and have that function run the VBA code).

--
Ken Snell
<MS ACCESS MVP>

in
 
K

Ken Snell

You'd need to put a public function in a regular module:

Public Function NameAndCreateNewFolder()
MkDir Forms!FormName!ControlName
End Function

(Substitute the real names for the generic ones I've listed above:
FormName; ControlName.)

Then use the RunCode action in a macro, and put NameAndCreateNewFolder() as
the function name.

Note that MkDir requires the full path to the new folder, unless you want
the new folder to be in whichever path is the current default path.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top