ToolTipText for record that is not selected in continuous form

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
 
G

Guest

I'm not sure how to fix, but the reason it displays the filename of the
selection is that this is in a GetFocus procedure. The focus doesn't change
with mouse motion; i.e., moving mouse over a control or record does not
change the focus. You have to select the record to change the focus.

Also, you should be able to use InStrRev() to get the last occurence of '\'
directly, rather than stepping through the string. Don't need the loop then.
 
K

Ken Snell [MVP]

Chaim is right. ControlTipText is displayed only for the "current" record,
regardless of which record your mouse is hovering over.
 
S

Stephen Lebans

Here is an alternative solution but could easily be adapted to Tooltips.
But I think there might be an issue with setting Access Tooltips for a
form in COntinuous view.

http://www.lebans.com/conformscurcontrol.htm
ContinuousFormsCurrentRow.zip is a class that allows you to
programmatically access the contents of a bound control, as the user
moves their Mouse, but the control does not have the focus. For Forms in
Continuous View.
--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
K

Ken Snell [MVP]

Or enable the textbox but lock it, then the user can click in the textbox
and be able to move through the text (or even copy it if needed).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top