Required combo box

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
 
D

Doug

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....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top