Wrox Programmer Forums
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 4th, 2007, 10:26 AM
Authorized User
 
Join Date: Apr 2004
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default Can I access the file system?

I've successfully got an Access VBA system working for my design business that handles job details, time recording, purchase orders etc. It works a treat but with one limitation - although I can create a new job record with one click, I can't create the job folder and subfolders in the Windows file system that each job needs. Is this possible with Acess VBA?
 
Old April 4th, 2007, 10:42 AM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 432
Thanks: 0
Thanked 1 Time in 1 Post
Default

Certainly is,

You need to reference the "Microsoft Scripting Runtime" (under Tools > References) in VBA.

This allows you to create a "FileSystemObject".

For example, to create a folder:
Code:
Dim fso as New FileSystemObject
fso.CreateFolder "C:\My New Folder"
fso.CreateFolder "C:\My New Folder\A Subfolder"
I hope this helps, if you get stuck then give me a shout.

Best Regards,
Rob
 
Old April 4th, 2007, 10:59 AM
Authorized User
 
Join Date: Apr 2004
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

That's great, thanks. One question, my available references are:
Microsoft Script Control 1.0
Microsoft Scripting Runtime
Microsoft Scriptlet Library

Which should I choose?



 
Old April 4th, 2007, 11:02 AM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 432
Thanks: 0
Thanked 1 Time in 1 Post
Default

Choose the "Microsoft Scripting Runtime".

 
Old April 4th, 2007, 11:16 AM
Authorized User
 
Join Date: Apr 2004
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Rob. This opens up exciting new avenues!

 
Old April 4th, 2007, 11:19 AM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 432
Thanks: 0
Thanked 1 Time in 1 Post
Default

No problem, good to hear.

Just be EXTREMELY careful with the "DeleteFile" method!






Similar Threads
Thread Thread Starter Forum Replies Last Post
Ms Access LENDING System? benhar03 Access 7 March 12th, 2011 09:00 PM
writing into a file in linux file system anboss XSLT 6 June 19th, 2008 01:56 PM
Access Workgroup System file iii_carlos BOOK: Professional Crystal Reports for VS.NET 0 February 12th, 2007 01:34 AM
File system gandhi BOOK: Professional SQL Server 2005 Integration Services ISBN: 0-7645-8435-9 2 March 22nd, 2006 05:23 PM
ACCESS is an internet database system? sotsot82 Access 1 September 24th, 2003 12:09 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.