[AccessD] A2K: Loop through files in a folder - to Drew

Drew Wutka DWUTKA at marlow.com
Wed Feb 5 09:34:01 CST 2003


Here's what I replied earlier to this question...

Because it's the only available 'file' I/O capability that you can use 
within VBScript.  A lot of network admins remove the runtime, so that 
scripts can't use it. 

Therefore, when you write VBA code (which has other options available), if 
it is possibly going to be used elsewhere, there is a chance it may not work

if the network/system admin has disabled it. 


Drew

-----Original Message-----
From: Tom Adams
To: accessd at databaseadvisors.com
Sent: 2/5/03 9:00 AM
Subject: Re: [AccessD] A2K: Loop through files in a folder - to Drew

Why stay away from the file scripting object??

Tom

----- Original Message ----- 
From: "Drew Wutka" <DWUTKA at marlow.com>
To: <accessd at databaseadvisors.com>
Sent: Tuesday, February 04, 2003 6:50 PM
Subject: RE: [AccessD] A2K: Loop through files in a folder


> Put this code behind your form:
> 
> Option Compare Database
> Option Explicit
> Dim strCurrentFile As String
> Private Sub Form_Load()
> strCurrentFile = Dir("Z:\*.*")
> End Sub
> Private Sub Form_Timer()
> If strCurrentFile <> "" Then
>     MsgBox strCurrentFile
>     strCurrentFile = Dir
> End If
> End Sub
> 
> That does what you want.  (Try to stay away from the file scripting
object
> when you can.)
> 
> Drew
> 
> -----Original Message-----
> From: Darren DICK [mailto:d.dick at uws.edu.au]
> Sent: Tuesday, February 04, 2003 8:00 PM
> To: AccessD at databaseadvisors.com
> Subject: [AccessD] A2K: Loop through files in a folder
> 
> 
> Hello all
> I have the following code in my forms timer, modified from the
> help, that gives me a MsgBox with all the files in a folder. So far so
good
> 
> I have the timer set for 5 seconds. What I want is for the routine to
show
> the
> next file name in a MsgBox every 5 seconds. But what is happening with
this
> code is I get as many MsgBox's as there are files every 5 seconds (by 
> keeping the enter key pressed)
> 
> How can I pause the FOR - NEXT code for 5 seconds??
> Or have it show 1 file every 5 seconds not every file in 5 seconds
> 
> Any suggestions??
> 
> Many thanks in advance
> Darren
> ++++++++++++++++++++++++++++++
> Sub ShowFilesInDir(strFolder As String)
>    Dim fs, f, f1, fc, s
>      Set fs = CreateObject("Scripting.FileSystemObject")
>      Set f = fs.GetFolder(strFolder)
>      Set fc = f.Files
> 
>      For Each f1 In fc
>          s = f1.Name
>      Next
> 
>      MsgBox s
> 
> End Sub
> ++++++++++++++++++++++++++++++
> 
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> 
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list