• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 577
  • Last Modified:

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
0
shacho
Asked:
shacho
  • 9
  • 4
2 Solutions
 
shachoAuthor Commented:
For reference, here is (approximately) the code that raises the form:
DoCmd.OpenForm "MyForm", acNormal, , "ID=111", acFormEdit, acDialog, "blah"

0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:

Try removing the acDialog and instead, set the Modal and Popup properties of MyForm to Yes.

DoCmd.OpenForm "MyForm", acNormal, , "ID=111", acFormEdit, , "blah"
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
"Form B also registers a click"

Also, not exactly sure what you mean by that ?

mx
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
shachoAuthor Commented:
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.

0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
Well ... guess I would have to 'be there' on this one.  But did you try what I suggested above ... removing acDialog  etc.

mx
0
 
shachoAuthor Commented:
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.
0
 
shachoAuthor Commented:
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
0
 
shachoAuthor Commented:
Nope - spoke too soon.  Still haven't worked it out.  More soon.
0
 
shachoAuthor Commented:
I really got it now.  You may remember this from yesterday.

"in the end i made two forms for the child table.  one is just a list with no code.  that one gets embedded as a locked subform, for which only two events exist: got and lost focus. if you click on or navigate to the subform with keys, it shows the real editor (the other form) then pushes the focus on to the next control.  it's soooooooo much easier and clear and reliable this way.  and it loads faster. "

So clicking in (or actually, "into") the subform triggers the launch of the form in question.  The subform is locked so the click "in" the subform appears to be a click "on" it.  In this way, it behaves like a button.  But the click ends up getting heard by the form that gets launched.  I don't know what happens behind the scenes, but somehow I suspect if the subform weren't locked, that click might get ignored by the pop up form.  I dunno.  Anyway, now I need to figure out how to work around this.  Bending Access form navigation behavior to your will sure takes a lot of stamina.

Mike

0
 
shachoAuthor Commented:
...and they call this "rapid" application development.
0
 
shachoAuthor Commented:
-
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:

Rapid is a Relative term.  At least it's not Rabid !!!

mx
0
 
shachoAuthor Commented:
Ha. You should have seen me after trying to troubleshoot this problem for 4 hours...
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 9
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now