Counting Files in a directory with FileSystemObject

A

Andrew

What I want to do is create two text fields on my form. Lets call them txtA
and txtB.

txtA needs to read the company name in txtCompany and look in the directory
"c:\mydata\" & strCompany and display the number of files in that directory.

txtB needs to open each file in that directory and count the number of lines
that begin with the word "device" (no quotes) and then display the total
number of lines that contain that string. The file it reads from will look
like this.

[General]
VAR = "123456789"
Device1 ="123456789 123456789"
Device1 ="123456789 123456789"
Device1 ="123456789 123456789"
Device1 ="123456789 123456789"

Thanks in Advance
 
Z

ZMan

-----Original Message-----
What I want to do is create two text fields on my form. Lets call them txtA
and txtB.

txtA needs to read the company name in txtCompany and look in the directory
"c:\mydata\" & strCompany and display the number of files in that directory.

txtB needs to open each file in that directory and count the number of lines
that begin with the word "device" (no quotes) and then display the total
number of lines that contain that string. The file it reads from will look
like this.

[General]
VAR = "123456789"
Device1 ="123456789 123456789"
Device1 ="123456789 123456789"
Device1 ="123456789 123456789"
Device1 ="123456789 123456789"

Thanks in Advance


.
What you need to do is your homework. Everything you need
to know is right in the Access help files. Read info on
file I/O, you'll soon be on your way with your project.
 
G

Guest

Ummm i have already done my homework enough to know to use the FSO - thats why I posted here for "help"

ZMan said:
-----Original Message-----
What I want to do is create two text fields on my form. Lets call them txtA
and txtB.

txtA needs to read the company name in txtCompany and look in the directory
"c:\mydata\" & strCompany and display the number of files in that directory.

txtB needs to open each file in that directory and count the number of lines
that begin with the word "device" (no quotes) and then display the total
number of lines that contain that string. The file it reads from will look
like this.

[General]
VAR = "123456789"
Device1 ="123456789 123456789"
Device1 ="123456789 123456789"
Device1 ="123456789 123456789"
Device1 ="123456789 123456789"

Thanks in Advance


.
What you need to do is your homework. Everything you need
to know is right in the Access help files. Read info on
file I/O, you'll soon be on your way with your project.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top