G
Guest
I am using a continuous form to enter a Path&FileName. My form cannot be wide
enough to display the file names with long paths so I have written code to
extract the file name from the path and display the file name in the
ToolTipText.
But this only works for the selected record. when the user ‘mouses-over’ a
record that is not selected, the tool tip displays the file name for the
selected record.
Any help appreciated.
Seth
Private Sub txtPdfLctn_GotFocus()
Dim strPath As String
Dim strFileName As String
Dim strCurrentChar As String
Dim X As Integer
If IsNull(txtPdfLctn) = True Then Me!txtPdfLctn.ControlTipText = "PDF report
has not been selected." Else GoTo GetFilename
Exit Sub
GetFilename: 'Seperate file name form path
strPath = txtPdfLctn
For X = Len(strPath) To 1 Step -1 'cycle through message string
strCurrentChar = Mid(strPath, X, 1) 'get the current character
If InStr("\", strCurrentChar) = 1 Then Exit For
strFileName = strCurrentChar & strFileName 'construct file name until
"\" is found
Next X
Me!txtPdfLctn.ControlTipText = strFileName
End Sub
enough to display the file names with long paths so I have written code to
extract the file name from the path and display the file name in the
ToolTipText.
But this only works for the selected record. when the user ‘mouses-over’ a
record that is not selected, the tool tip displays the file name for the
selected record.
Any help appreciated.
Seth
Private Sub txtPdfLctn_GotFocus()
Dim strPath As String
Dim strFileName As String
Dim strCurrentChar As String
Dim X As Integer
If IsNull(txtPdfLctn) = True Then Me!txtPdfLctn.ControlTipText = "PDF report
has not been selected." Else GoTo GetFilename
Exit Sub
GetFilename: 'Seperate file name form path
strPath = txtPdfLctn
For X = Len(strPath) To 1 Step -1 'cycle through message string
strCurrentChar = Mid(strPath, X, 1) 'get the current character
If InStr("\", strCurrentChar) = 1 Then Exit For
strFileName = strCurrentChar & strFileName 'construct file name until
"\" is found
Next X
Me!txtPdfLctn.ControlTipText = strFileName
End Sub