Wildcard search within Windows Explorer

hillsee

Registered User.
Local time
Today, 15:09
Joined
Dec 22, 2004
Messages
18
Hiya, noob question here. Access 2003

Within company database there is a form that contain the details of each project each listed with its own unique 'projectID'. On this form I have buttons which opens up windows explorer to a specified folder on our server with the same name as the 'projectID'

i.e. project 'smith10' will open a folder on the server called 'smith10'. Simple enough. Here is the code i use on the button:

Dim ProjPath
ProjPath = "Z:\Projects 2007\" & Me.ProjectID.Value

Shell "C:\WINDOWS\explorer.exe """ & ProjPath & "", vbNormalFocus

PROBLEM is that my director has decided to add extra details on the folder on the server i.e 'smith10 Hey Lane'

how do i still use the same button, ive tried using wildcards but i cant get it to work.

any help would be appreciated.

NOTE: all projectID's are made up of 5 letters or less and a two digit number.
 
this code might help you find the folder you are looking for on your network drive. Within the For Each objFolders ... loop, you can look for the first 5 (or 7) characters that you know should be there, and therefore find the whole folder name.
Code:
Function mFSO()
Dim fso As FileSystemObject
Set fso = New FileSystemObject
Dim objFolder As Folder
Dim objFolders As Folder
  Set objFolder = fso.GetFolder("C:\")
  For Each objFolders In objFolder.SubFolders
    Debug.Print objFolders.name
  Next objFolders
  
  Set fso = Nothing

End Function
 
hiya, thank you very much i will give it a try.

thanx again
 

Users who are viewing this thread

Back
Top Bottom