Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Private Sub MyComboBox_MouseDown(Button As Integer, Shift As Integer, [highlight]X As Single, Y As Single[/highlight])
End Sub
Private Sub cboMyComboBox_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Me.txtX = X
Me.txtY = Y
[green] 'assumes the width of the arrow is 255 twips[/green]
If Me.cboMyComboBox.Width - X < 255 Then
Me.txtX.ForeColor = vbRed
Else
Me.txtX.ForeColor = vbBlack
End If
End Sub
Private Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) As Long
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTL) As Long
Private Declare Function apiGetClassName Lib "user32" Alias "GetClassNameA" (ByVal hwnd As Long, ByVal lpClassname As String, ByVal nMaxCount As Long) As Long
Private Const ACC_CBX_EDIT_CLASS = "OKttbx" ' class name for Edit controls in Access
Private Type POINTL
X As Long
Y As Long
End Type
Private WithEvents mCB As Access.ComboBox
Public Sub SetControl(ByVal oComboBox As Access.ComboBox)
Set mCB = oComboBox
mCB.OnMouseDown = "[Event Procedure]" 'Enable combobox events
End Sub
Private Sub mCB_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
'ComboBox has the Focus
If fCBDownArrowClicked Then
'ComboBox Down Arrow has been clicked
End If
End Sub
Private Function fCBDownArrowClicked() As Boolean
Dim lRet As Long
Dim hwnd As Long
Dim pt As POINTL
'Find current Cursor position
lRet = GetCursorPos(pt)
'Get this point's Window
hwnd = WindowFromPoint(pt.X, pt.Y)
'Class Name is 'oFormChild' if CB down arrow was clicked in a single or continuous form
' or 'oGrid" if CB down arrow was clicked in a datasheet form
' or 'OKttbx' if CB Edit Box (to the left of the down arrow) was clicked
If fGetClassName(hwnd) <> ACC_CBX_EDIT_CLASS Then cbDownArrowClicked = True
End Function
Private Function fGetClassName(hwnd As Long)
Dim strBuffer As String
Dim lngLen As Long
Const MAX_LEN = 255
strBuffer = Space$(MAX_LEN)
lngLen = apiGetClassName(hwnd, strBuffer, MAX_LEN)
If lngLen > 0 Then fGetClassName = Left$(strBuffer, lngLen)
End Function