I would like to write a bit of code into a form that counts the number of
folders in the "D:/1"directory like "* - Done" and like "*". I have found
lots of code that counts files but none that count the folders they reside in.
Can anyone suggest anything?
Thanks!
Brandon Johnson - 09 Feb 2007 16:41 GMT
On Feb 8, 1:02 pm, "pubdude2003 via AccessMonster.com" <u10672@uwe>
wrote:
> I would like to write a bit of code into a form that counts the number of
> folders in the "D:/1"directory like "* - Done" and like "*". I have found
[quoted text clipped - 6 lines]
> --
> Message posted via AccessMonster.comhttp://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200702/1
Dim temp As Folders, names As Integer
Dim oFileSystem As New FileSystemObject
Set temp = oFileSystem.GetFolder(textbox1)
names = temp.Count
try that. i havent tested it at all.
Brandon Johnson - 09 Feb 2007 16:42 GMT
On Feb 8, 1:02 pm, "pubdude2003 via AccessMonster.com" <u10672@uwe>
wrote:
> I would like to write a bit of code into a form that counts the number of
> folders in the "D:/1"directory like "* - Done" and like "*". I have found
[quoted text clipped - 6 lines]
> --
> Message posted via AccessMonster.comhttp://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200702/1
or even look at this site...
http://abstractvb.com/code.asp?A=716
pubdude2003 - 10 Feb 2007 13:40 GMT
kewl, thanks Brandon, I'm about two code lines from what I want with that web
page link
THANKS!
pubdude2003 - 11 Feb 2007 12:59 GMT
well maybe not two
Private Sub Command1_Click()
FilesInFolder ("D:/1/")
End Sub
Function FilesInFolder(folderspec) As Long
Dim objFSO As Object
Dim objFolder As Object
Dim filesinfolder2 As Long
Dim datnumber As Integer
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(folderspec)
Set oFS = CreateObject("Scripting.FileSystemObject")
Set oF = oFS.GetFolder(folderspec)
Me!Text10 = oF.subfolders.Count
Set objFolder = Nothing
Set objFSO = Nothing
End Function