Problem with Combo Box

C

Chaplain Doug

Access XP. I have a combo box named SAPSTATUS in a form
which should only allow the values "Interview" or "Remove"
to be entered. I have set Limit to List to "Yes." I have
code that runs on the Change event. In this code I test
the value of the control. If the user enters "Interview",
then the value of the control upon entry to the code
is "Interview." However, if the user blocks
out "Interview" and hits the backspace (thus deleting the
value), upon entry to the code the value of the control is
still "Interview." However, upon return from the event
routine, the value is indeed deleted. How may I know that
the user has deleted the value in the control when I get
to the Change event routine? Thanks.

Chaplain Doug
 
J

John Vinson

Doesn't AfterUpdate only trigger when you move to another
record? I need to catch changes being made while still on
the same record.

That's the *form's* AfterUpdate event. Each control has its own
AfterUpdate event which fires when the user exits the control after
having changed something, or when they select a row from a combo or
listbox.
 
C

Chaplain Doug

True. But the control AfterUpdate event occurs after the
AfterChange. I need to us the AfterChange. My original
question still stands. Thanks.
 
K

Ken Snell

Test the .Text property of the combo box as well as the .Value property. The
..Text property will be what is currently visible in the combo box display.
 
D

Dan Artuso

Hi,
Have you tried checking the Text property of the combo?
That should give you the empty string.
 
J

John Vinson

True. But the control AfterUpdate event occurs after the
AfterChange. I need to us the AfterChange. My original
question still stands. Thanks.

The Change event fires once with every keystroke; if you have a Combo
based on a text field, the Change event will fire multiple times as
the user types to autocomplete a selection.

What event do you need to happen *that often*?
 

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