AnyIdea

A

a

dear friends:
i have a folder in my hard disk contain file name
is there any way to copy all this file Name only to access table by code
example

FieldFileName
doc1
doc2
doc3
doc4
doc5
and so on
thank you
 
T

Tom van Stiphout

You'll have to first figure out how to extract a filename from a full
path. Say you have:
strPath = "c:\testa\testb\doc1.doc"
Use a combination of InStr, StrRev, Left, Mid to extract "doc1"

Once you have that figured out, check the help file on the Dir
function. It has an example of how to iterate over a folder.

Then you need a way to add the extracted filename to a table; perhaps
using an Append query, or a Recordset.

Best of luck,

-Tom.
Microsoft Access MVP
 
K

KARL DEWEY

You can use a DOS command (I guess most folks have forgoten DOS) to create a
..txt file.

Click on START, Run... enter CMD and click OK. This gets you to a DOS
window.
The drive and folder names will be displayed on the prompt line.

You can either go to the folder or use the drive and path in the DOS command.

To go to folder enter drive letter followed by colon and press ENTER. The
prompt line will change to reflect the drive like this -- H:\> -- for 'H'
drive. Then use CD followed by next folder name in the path. Prompt line
will reflect like this -- H:\My Documents> -- and continue to desired
folder.
NOTE - CD.. backs up one folder level.
- CD\ takes you to root drive.
- HELP DIR list the switches used with the Directory command.

To create file use this command line --
DIR>MyFileList.txt
OR
DIR>c:\My Documents\MyFileList.txt
The first creates the file on same drive, the second includes path.
 
M

Mike Painter

Tom said:
You'll have to first figure out how to extract a filename from a full
path. Say you have:

Once you have that figured out, check the help file on the Dir
function. It has an example of how to iterate over a folder.
Use the Split function

Dim MyArray() as Array
Dim FileName as string

strPath = "c:\testa\testb\doc1.doc"

MyArray = Split(strPath,"\")
Filename = MyArray(ubound(MyArray))
 

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