Excellent question! It got me thinking some more and I discovered the
reason. My mouse is set to 'Snap To'. The pointer is snapping to the next
focused command button. During the execution of the code, a brief flash of
some dialog box appears, stealing the pointer and leaving it there. I'm
uncertain what this dialog box is...I suspect it has to do with fetching the
new image file. Turning off the 'Snap To' feature in the mouse driver solves
the problem. However, this is not a preferred solution since I can't predict
if another user will have the same feature turned on.
Is there a way to temporary defeat the 'Snap To' feature of the mouse?
One solution I'd like to try is simply capturing the x,y coordinates of the
pointer with the On_Mouse_Down event and then assign these back somehow as
the last line of code in the ComboB1_AfterUpdate(). Problem is I can't find
any methods to move the pointer from code.
Here is the current code. Each click will sequence through an unbound combo
box query, update the image Picture property .gif file and a compute results
in a textbox.
Here is the code:
--------------------------------------------------------
Option Compare Database
Option Explicit
Public iB1 As Integer
----------------------------------------------------
Private Sub ImageB1_Click()
If iB1 < 10 Then
iB1 = iB1 + 1
Else
iB1 = 1
End If
ComboB1_AfterUpdate
End Sub
---------------------------------------------------------
Private Sub ComboB1_AfterUpdate()
Dim path As String
Dim fName As String
path = CurrentProject.path
fName = "Pic\" & Me.ComboB1.Column(2, iB1)
Me.ImageB1.Picture = path & "\" & fName
Me.TextVal = (Me.ComboB1.Column(1, iB1) & _
Me.ComboB2.Column(1, Me.ComboB2.ListIndex + 1)) * _
Me.ComboB3.Column(1, Me.ComboB3.ListIndex + 1)
Me.TextHT = (Me.TextVal * Me.ComboB4.Column(3,
Me.ComboB4.ListIndex)) + Me.TextVal
Me.TextLT = Me.TextVal - (Me.TextVal * Me.ComboB4.Column(3,
Me.ComboB4.ListIndex))
Me.CmdRefresh.Enabled = True
Me.ComboB1 = Me.ComboB1.Column(0, iB1)
End Sub