Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data File Access

Status
Not open for further replies.
Jan 20, 2005
180
US

I need to access 2 files that are in specified directories. However the specified Directories have only 1 thing in common.

Example...

c:\Current\Active\
or
c:\Current\Completed\

The common peice is the following PO number
### - Address
Where the ### is our PO number currently only 3 digits but the seperator of - will keep me from having an issue here.

So then end path looks something like this
c:\Current\Active\444 - 12345 This Str (Maybe other Stuff here)\File

What I am needing is to get the correct path from the Active or Completed directories by parsing the directory list in those 2 base dir's.

The only information that I know is the PO number when trying to get the files.

What are the filesystem functions in Access, or is there a possible FAQ that I have not found that can lead me in the correct direction?
 
Some FSO functions I used in the past:
Code:
Private Sub FSOSamples()

    Dim objFSO As Object
    Dim objFolder As Object
    Dim objFolderContents As Object
    Dim objFile As Object
    Dim strPathCheck As String
      
    strPathCheck = "c:\Current\Active\"
    
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objFolder = objFSO.GetFolder(strPathCheck)
    Set objFolderContents = objFolder.Files

    Debug.Print Dir(CurrentProject.Path, vbDirectory)

    For Each objFile In objFolderContents
                            
         Debug.Print objFile.Path
         Debug.Print objFile.Name
         Debug.Print objFile.Type
         Debug.Print objFile.DateCreated
                  
    Next
End Sub

Some InStr functions:
Code:
strPathCheck = "c:\Current\Active\444 -\File"

y = InStr(strPathCheck, "-")
x = InStrRev(strPathCheck, "\", y) + 1
     
Debug.Print Mid$(strPathCheck, x, y - x)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top