shacho
asked on
Mouse Cursor Location and Form Behavior on Open
I have a button on a form that raises another modal form. Oddly (and disturbingly) the form that opens also sinks the mouse click. So, in other words, the sequence of events is:
1) Click button on Form A
2) Button raises Form B
3) Form B also registers a click
That just won't do. I don't feel like I should have to work around this with mouse events. What's wrong here?
Mike
1) Click button on Form A
2) Button raises Form B
3) Form B also registers a click
That just won't do. I don't feel like I should have to work around this with mouse events. What's wrong here?
Mike
Try removing the acDialog and instead, set the Modal and Popup properties of MyForm to Yes.
DoCmd.OpenForm "MyForm", acNormal, , "ID=111", acFormEdit, , "blah"
"Form B also registers a click"
Also, not exactly sure what you mean by that ?
mx
Also, not exactly sure what you mean by that ?
mx
ASKER
I click the launch button in Form A, then Form B opens, and if there happens to be a button on B right underneath the mouse cursor, that button also gets pushed.
I have a routine that alters the row source of a control on Form B that runs when the form loads. Somehow that process is messing things up. If I block that code, the aforementioned phenomenon does not happen.
I have a routine that alters the row source of a control on Form B that runs when the form loads. Somehow that process is messing things up. If I block that code, the aforementioned phenomenon does not happen.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Strike that. I got it now. There's a control that drops down automatically on enter. It's also the first control. That dropping down is the cause of the problem. I think it goes something like this: The list drops momentarily - then the row source is changed. This cancels the drop, but Access assumes the drop was cancelled by a click so it looks for the location of the mouse cursor and clicks.
ASKER
Solved with a new understanding (thanks for that yesterday) of Key events.
Private Sub cbxItemType_KeyUp(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyTab Then Me.cbxItemType.DropDown
End Sub
Instead of ...
Private Sub cbxItemType_Enter()
Me.cbxItemType.DropDown
End Sub
Private Sub cbxItemType_KeyUp(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyTab Then Me.cbxItemType.DropDown
End Sub
Instead of ...
Private Sub cbxItemType_Enter()
Me.cbxItemType.DropDown
End Sub
ASKER
Nope - spoke too soon. Still haven't worked it out. More soon.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
...and they call this "rapid" application development.
ASKER
-
Rapid is a Relative term. At least it's not Rabid !!!
mx
ASKER
Ha. You should have seen me after trying to troubleshoot this problem for 4 hours...
ASKER
DoCmd.OpenForm "MyForm", acNormal, , "ID=111", acFormEdit, acDialog, "blah"