I understand what you want, and I worked on solving this problem for about 30
minutes. Here's the best I could come up with:
In your combo box's OnLostFocus event, code something like this:
If IsNull(Me.comboBox.Value) Then
DoCmd.GoToControl [some other control on your form]
Me.comboBox.Visible = False
End If
(You have to GoTo another control on your form before you hide the combo box
because if you don't you'll get an error message saying something like "you
can't hide a control that has the focus")
So...that takes care of it the user clicks in another control. Now, to hide
the combo box if they just click outside of it, I figured I could just put
that same code in the OnClick event of the Detail section of your form. But
for some crazy reason, when I put that exact code in the OnClick event of the
Detail section, it spit me out an error on the GoToControl line, saying it
"couldn't go to control [controlName]"
So if you know of a way to take focus off of the combo box programatically
without moving to another control, then above code could work in both places
and you'd be in business, but I don't know how to do it.
That's all I got. Good luck.
-ndalton
LongWayFromHome said:
I must not be clear about what I'd like to do: if the combox is Null and the
user clicks anywhere else on the form (in a control or not) the event is
triggered. OnExit seems to require clicking on another control, but I'd also
like to monitor the space between controls, if that is possible.