'フルパスからファイル名のみ取得
Function GetFileName(fullpath As String) As String
Dim i As Integer
Dim nlen As Integer
Dim s As String
On Error GoTo Errsub
nlen = Len(fullpath)
For i = nlen To 0 Step -1
s = Mid$(fullpath, i, 1)
If s = "\" Then Exit For
Next
s = Right$(fullpath, nlen - i)
GetFileName = s
Exit Function
Errsub:
GetFileName = ""
End Function
'コマンドボタン クリックイベント
Private Sub コマンド0_Click()
Me!コマンド0.Caption = GetFileName("C:\MyAccess\access.mdb")
End Sub