Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Datasheet View - ToolTips

Status
Not open for further replies.

mastertorr

Programmer
Dec 21, 2006
36
CA
Im pretty certain, almost positive, this cannot be done, but figured i would ask. Is it possible to have a custom tool-tip when the mouse hovers over a field in datasheet/table view in access?

Scenario: Field A holds a string such as "A12"

When a person hovers over this field, a custom tooltip would be displayed giving a description of what A12 represents, by searching for the description in another table.
 
Didn't think there was a way from the table. Just figured i'd ask encase someone had discovered a way.
Thanks for your reply.
 
Here is some code that demo's how to do it with a continous form if you want it

Code:
Private Sub Form_Load()
 Me.OrderID.ControlTipText = getText(recordNo)
End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  Dim strToolTip As String
  If Not getRecord(Y) = recordNo Then
    recordNo = getRecord(Y)
    strToolTip = getText(recordNo)
    Me.txtToolTip = strToolTip
    Me.OrderID.ControlTipText = strToolTip
    Me.ProductID.ControlTipText = strToolTip
  End If
  'Me.txtToolTip = Y
End Sub

Public Function getRecord(ByVal Y As Single) As Long
  Dim htrec As Long
  htrec = Me.Detail.Height
  'Form Header
  Y = Y - Me.Section(1).Height
  getRecord = (Y \ htrec)
 
End Function
Public Function getText(recNo As Long) As String
  On Error GoTo errlable
  Dim rs As Recordset
  Set rs = Me.RecordsetClone
  rs.MoveFirst
  If Not recNo > rs.RecordCount Then
    rs.Move (recNo)
    getText = "Rec No: " & recNo & " ID: " & rs!OrderID & " Name: " & rs!ProductName & " Quantity: " & rs!Quantity & " Unit Price: " & rs!UnitPrice
  End If
  Exit Function
errlable:
  If Err.Number = 3021 Then
    Exit Function
  Else
    MsgBox Err.Number & " " & Err.Description
  End If
End Function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top