Required combo box

  • Thread starter Thread starter BILL T.
  • Start date Start date
B

BILL T.

How do I make a combo-box on a form require you to select
from it. In other words it cannot be left blank you have
to pick something or else it won't let you move to the
next control. I set the underlying table field required
property to yes but this does nothing.
Thanks
 
I have been able to do this with two events - someone else might have a more
eloquent solution. For some reason I have never had much luck with the
setfocus working in the same routine checking for a lost focus.

Use the 'Lost Focus' event of the control you don't want to be blank -

if isnull(me.combobox) = true then
msgbox("you cant leave this blank")
me.combobox.setfocus
end if

Use the 'Got Focus' event of the next control in the tab order -

if isnull(me.combobox) = true then
me.combobox.setfocus
end if

That does it....
 
Back
Top