Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access 2007, Drive, Folder queries.

Status
Not open for further replies.

Djbell

IS-IT--Management
Apr 22, 2002
175
GB
Hi All

Is it possible through coding to get a query to do the following?

Query 1
List the contents of a specific folder on a computer which displays the following.
Name / Size / Date Modified (Basically Like the Details view of a Folder)

Query 2
List Drive Information
So basically a Query that shows the information in Diskmanagement.

Disk Name, Volume, Capacity, Free Space, % Free.

I am creating an automatic reporting tool for IT Security and the above is a requirement, at the moment I am having to enter the information manually.

Cheers

Dougie

 
You can use the FileSystemObject to get this information, but it is not in the form of a query.

Code:
'You can use a reference to Windows Script Host object Model

Dim fs As Object 'FileSystemObject
Dim f As Object 'File
Dim fldr As Object 'Folder
Dim d As Object 'Drive

Set fs = CreateObject("Scripting.FileSystemObject")

Set fldr = fs.GetFolder("C:\Docs\")
For Each f In fldr.Files
    Debug.Print f.Name; f.Size; f.DateLastModified
Next

For Each d In fs.Drives
    If d.IsReady Then
        Debug.Print d.DriveLetter; d.VolumeName; d.FreeSpace; d.TotalSize
    End If
Next

 
Hi

Thanks for the reply.

How do I use these functions to populate a query? Also how do I use the drive information function to connect to other PCS on the netwrok and get the drive information on them.

Cheers

Dougie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top