Dynamic Path coding help

pat_nospam

Registered User.
Local time
Today, 23:02
Joined
Oct 14, 2003
Messages
151
Code:
Dim strPath As String
    Dim intCounter As Integer
    
    Set db = CurrentDb
    strPath = db.Name
    db.Close
    Set db = Nothing
        
    For intCounter = Len(strPath) To 1 Step -1
        If Mid$(strPath, intCounter, 1) = "\" Then
            Exit For
        End If
    Next intCounter
    
    GetPathPart = Left$(strPath, intCounter)

End Function

I'd like to be able to add a subdirectory to the end of the strPath (a sub directory in the db.Name path area, i.e. c:\desktop\database\subdirectory)

How would I add that to the strPath?

strPath = db.Name + "\subdirectory\" ?

Thanks in advance :)
 
pat_nospam said:
I'd like to be able to add a subdirectory to the end of the strPath (a sub directory in the db.Name path area, i.e. c:\desktop\database\subdirectory)

How would I add that to the strPath?

strPath = db.Name + "\subdirectory\" ?

Thanks in advance :)


Best to use
Code:
strPath = db.Name & "\subdirectory"

You don't need the ending backslash if you are just going subdirectory level. If you are going file level then:

Code:
strPath = db.Name & "\subdirectory\filename"
 

Users who are viewing this thread

Back
Top Bottom