<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Grab filenames</TITLE>
<META http-equiv=Content-Type content="text/html; charset=US-ASCII">
<META content="MSHTML 6.00.2800.1170" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=735322017-19052003><FONT face=Arial color=#0000ff size=2>Roz -
Will this work for you?</FONT></SPAN></DIV>
<DIV><SPAN class=735322017-19052003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=735322017-19052003><FONT face=Arial color=#0000ff
size=2>Private Sub cmdFileObject_Click()<BR>' Provides the user Path, File
Name,<BR>' and File Size<BR>' Insure there is a reference to the<BR>' Microsoft
Scripting Runtime<BR>' Access 2000/2002<BR> On Error GoTo
cmdFileObject_ERR<BR> <BR> Dim fso As
FileSystemObject<BR> Dim f1 As File<BR> Dim
strPathAndFileName As String<BR> Dim strFileNameOnly As
String<BR> Dim strFileSize As String<BR> Dim
I As Double<BR> <BR> Set fso =
CreateObject("Scripting.FileSystemObject")<BR>
<BR> With
Application.FileSearch<BR>
.NewSearch<BR> .LookIn =
"d:\"<BR> .FileName =
"*.ini"<BR> .MatchTextExactly =
False<BR> .FileType =
msoFileTypeAllFiles<BR>
.SearchSubFolders = True<BR>
<BR> If .Execute() > 0
Then<BR> For I
= 1 To
.FoundFiles.Count<BR>
DoEvents<BR>
' File name
and its path<BR>
strPathAndFileName =
.FoundFiles(I)<BR>
Set f1 =
fso.GetFile(.FoundFiles(I))<BR>
strFileSize = f1.Size</FONT></SPAN></DIV>
<DIV><SPAN class=735322017-19052003><FONT face=Arial color=#0000ff
size=2> '
File name
only<BR>
strFileNameOnly =
f1.Name<BR>
Next I<BR>
MsgBox "Done"<BR>
Else<BR>
MsgBox "No Files Found"<BR> End
If<BR> End With<BR> </FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=735322017-19052003><FONT face=Arial color=#0000ff
size=2>cmdFileObject_EXIT:</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=735322017-19052003><FONT face=Arial color=#0000ff
size=2> Exit Sub<BR>
<BR>cmdFileObject_ERR:</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=735322017-19052003><FONT face=Arial color=#0000ff
size=2> If Err.Number = 70 Then ' Permission
denied<BR> Resume
Next<BR> End If<BR> MsgBox
Error$<BR> <BR>End Sub<BR></FONT></SPAN></DIV>
<DIV><SPAN class=735322017-19052003><FONT face=Arial color=#0000ff size=2><!-- Converted from text/rtf format -->
<P><B><I><FONT face="Times New Roman" color=#0000ff size=4>John V.
Ruff</FONT><FONT face="Times New Roman" color=#008080 size=4> – The Eternal
Optimist</FONT><FONT face="Times New Roman" size=4></FONT> <FONT face=Wingdings
color=#800080 size=4>J</FONT></I></B><I></I> <BR><B><I><FONT
face="Times New Roman" color=#000080 size=2></FONT></I></B></P>
<P><B><I><FONT face="Times New Roman" color=#000080 size=2>“Commit to the Lord
whatever you do,</FONT></I></B> <BR><B><I><FONT face="Times New Roman"
color=#000080
size=2>
and your plans will succeed.” Proverbs 16:3</FONT></I></B><I></I>
</P></DIV></FONT></SPAN>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma
size=2>-----Original Message-----<BR><B>From:</B>
accessd-bounces@databaseadvisors.com
[mailto:accessd-bounces@databaseadvisors.com]<B>On Behalf Of </B>Roz
Clarke<BR><B>Sent:</B> Monday, May 19, 2003 7:54 AM<BR><B>To:</B>
'accessd@databaseadvisors.com'<BR><B>Subject:</B> [AccessD] Grab
filenames<BR><BR></FONT></DIV>
<P><FONT face=Arial size=2>Hi all</FONT> </P>
<P><FONT face=Arial size=2>Does anyone have a code snippet for pulling file
search results into Access?</FONT> </P>
<P><FONT face=Arial size=2>What I want is to pull the filename, path &
size of all files of a given type on a particular drive, including those in
subfolders, into a table. I need to do it *fast*!!!</FONT></P>
<P><FONT face=Arial size=2>TIA</FONT> </P>
<P><FONT face=Arial size=2>Roz</FONT> </P></BLOCKQUOTE></BODY></HTML>