Hi, I am brand new to the site and have only been working on programming my database for the last three weeks. I have gotten a lot of information from here but I have one thing that is not wanting to work and I can't find information on it. What I want to do is use three fields in my database as my file structure on the server we use.
I have three fields named ProjectNumber, County, City and the "strPath" I want to use is basically (can't name the true path) "X:\AAA\BBB\CCC\DDD"
The jist of what I want to do is make a code that says to create a file structure as such - X:\AAA\BBB\CCC\DDD\County\City\ProjectNumber
I have the code that creates the County directory just fine (thanks to information found here) but I can't figure out what to do so that it will take all of the fields and make the ENTIRE path. This is the code that I used to get it to make the County directory just fine:
Private Sub ProjectNumber_AfterUpdate()
strPath = "X:\AAA\BBB\CCC\DDD" & Me.County
If Len(Dir(strPath, vbDirectory)) = 0 Then
MkDir strPath
End If
Shell "explorer.exe " & strPath, vbNormalFocus
End Sub
As you can see, what it does is creates the directory and then brings it up once it is created. I want the program to check and make sure though that if the county I put into the record exists, it doesn't try to create a directory for it and then not work. For instance, if the county is already up as a folder, I don't want it to try to create a new directory that already exists, but otherwise go ahead and create a new city directory instead. Likewise, if the county and city already exist, then just put a new project number directory under the city directory. I know this is probably a simple thing but I can't get it to work. Again I am trying to use the "Me.County" then subdirectory "Me.City" and then subdirectory "Me.ProjectNumber."
If anyone has some advice and you could tell me how to get this to work so I don't have to fuss with it anymore I would appreciate it beyond anyone's understanding.
jpihpa