folder and file problem

M

Michael

Hi,

I have the following situation (in short):

form with personnel data
subform with projectnumbers that the person is attending

I want to export the ID number of the person to Excel whilst/after i enter
the projectnumber (and some other data) in the subform.

On a folder level it is arranged as follows:

P:\[Projecttype]\ (ie: 201 or 202 or 203)
then projectnumber (ie: P:\201 - NON VAT projects\201.047 - [name of
project])
and in each projectfolder I have a "Registration" folder with an excel sheet
where additional data is entered (a lot of variable columns that i dont have
in access, specific for that project)

Now me problem is that I know which type (201 or 202 etc..) I also know with
what the subfoldername starts (projectnumber) and what the excel sheet is
named BUT the FULL name I dont know (at least not in access for each
project).

Is there a way in VBA to lookup a folder that starts with lets say 201,
record what the full name is and then look further in (p:\201 [rest of the
name]\ on projectnumber, and record that and so on?

I dont know if you understand what i am asking, if not let me know so i can
provide some additional info.

Txs in advance,

Michael
 
C

Chris

Look at the DIR function:

Dim strPath As String
Dim strFile As String


strPath = "C:\"
strFile = Dir(strPath & "*.", vbDirectory)
Do Until strFile = ""
Debug.Print strFile
strFile = Dir
Loop


Chris
 
M

Michael

Txs Chris,

Because of youre directions i was able to figure it out.

Michael


Chris said:
Look at the DIR function:

Dim strPath As String
Dim strFile As String


strPath = "C:\"
strFile = Dir(strPath & "*.", vbDirectory)
Do Until strFile = ""
Debug.Print strFile
strFile = Dir
Loop


Chris

-----Original Message-----
Hi,

I have the following situation (in short):

form with personnel data
subform with projectnumbers that the person is attending

I want to export the ID number of the person to Excel whilst/after i enter
the projectnumber (and some other data) in the subform.

On a folder level it is arranged as follows:

P:\[Projecttype]\ (ie: 201 or 202 or 203)
then projectnumber (ie: P:\201 - NON VAT projects\201.047 - [name of
project])
and in each projectfolder I have a "Registration" folder with an excel sheet
where additional data is entered (a lot of variable columns that i dont have
in access, specific for that project)

Now me problem is that I know which type (201 or 202 etc..) I also know with
what the subfoldername starts (projectnumber) and what the excel sheet is
named BUT the FULL name I dont know (at least not in access for each
project).

Is there a way in VBA to lookup a folder that starts with lets say 201,
record what the full name is and then look further in (p:\201 [rest of the
name]\ on projectnumber, and record that and so on?

I dont know if you understand what i am asking, if not let me know so i can
provide some additional info.

Txs in advance,

Michael


.
 

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