Examine directory & use results in label

arage

Registered User.
Local time
Today, 06:41
Joined
Dec 30, 2000
Messages
537
I’d like to set up a form with several buttons, earch with a distributor name on it & a number too. The number is a count of the shipping files each distributor has, waiting to be processed. These files sit at various places on our network directory, is there some way for me to tell access to “count” or “examine” a directory listing & place the calculation on my form somehowe? Hope this makes sense.
 
If I read you correctly then you want to read file names from folders?

the FileSytemObject will do this for you.

If you'd like an example I could post one tomorrow when I get into work.
 
Hi crosmill...yeah something like that i want to be able to go into a directory & determine how many (and type) of shipping files i have for each distributor. The only way i can do this is by the naming convention the file is sent to me with.
 
Here you go

Private Sub Import_Files_Click()


Dim FileName As String
Dim objFSO
Dim objFolder
Dim objFile


Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder("J:\Britvic File Import\File Imports\")

For Each objFile In objFolder.Files
FileName = objFile.Path
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel7, "Imported Files", FileName, True, "B39:U119"
Next

End Sub


This is importing an excel spreadsheet, but it's reading the folder to see whats in there first, you should be able to work out what you want from this.

Post back if you get stuck

hth
 

Users who are viewing this thread

Back
Top Bottom