Originariamente inviato da cicciobombo
no mi prende anche il nome del db.
e non so come fare a toglierlo..
Ciao
mi sembra molto strano, ma se lo dici tu...


senti, prova questa routine che ho scritto io:
codice:
Private Sub Comando1_Click()
    Dim strPercorso As String
    DividiNomePercorsoFile strPercorso
    MsgBox strPercorso
End Sub
Private Sub DividiNomePercorsoFile(ByRef strPerc As String)
    
    Dim intPos As Integer
    Dim intLunghStringa As Integer
    Dim intIndice As Integer
    Dim strValore As String
 
    Const strSeparatore = "\"
    
    strValore = CurrentDb.Name
    intLunghStringa = Len(CurrentDb.Name)
    
    intIndice = 1
    
    ' Cicla la stringa del percorso
    Do Until intLunghStringa = 0
        ' Cerca nella stringa del percorso il backslash
        intPos = InStr(1, strValore, strSeparatore, vbTextCompare)
        ' Se la posizione è maggiore di zero 
        '   si tratta ancora della directory
        If intPos > 0 Then
 
             strPerc = strPerc & Left(strValore, intPos)
             strValore = Right(strValore, Len(strValore) - intPos)
             intLunghStringa = Len(strValore)
             intIndice = intIndice + 1
 
        Else ' Si tratta del nome del file
 
             strNome = strValore
             intLunghStringa = 0
 
        End If
 
    Loop
        
End Sub