Combo won't let me change my mind

  • Thread starter Thread starter Jim Shaw
  • Start date Start date
J

Jim Shaw

BlankI use a combobox to lookup a value in a table.
In the OnClick event I store the value returned by the combobox in to a
bound textbox..
So far so good.

Now, when I reclick the combobox on a new value, Access 2002 tells me I
"need to save the record before updating this field"!!
The debug button takes me to the VBA (above) that stores the value.
Whyizzat??!! I'm not allowed to change my mind? Can this be fixed?

Thanks
Jim
 
BlankI use a combobox to lookup a value in a table.
In the OnClick event I store the value returned by the combobox in to a
bound textbox..
So far so good.

Now, when I reclick the combobox on a new value, Access 2002 tells me I
"need to save the record before updating this field"!!
The debug button takes me to the VBA (above) that stores the value.
Whyizzat??!! I'm not allowed to change my mind? Can this be fixed?

Thanks
Jim

Why the extra step?

A bound combo box stores a value in the Control Source field in the
table anyway. There's no need to write any code or have a separate
textbox!

If you're (unwisely, usually: redundant data storage is rarely a good
idea) storing two fields from the combo box, don't use the Click
event; use the AfterUpdate event instead. It fires after the user has
selected a record from the combo; Click fires the moment they click
the combo, before they make a selection.

John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps
 
Hi John,
I'm not experiencing, in Access 2002, what you are describing...
I set up a blank form with a combo box to do a test.
I put a msgbox command in each of the two events (AfterUpdate, and Click)
I clicked all over the combobox and no Click event fired...even when I
clicked on the dropdown button.
When a clicked on an item in the dropdown list, both events fired, first the
AfterUpdate, then the Click event.
If I type an entry in the combo box, the AfterUpdate fires without the Click
event firing.

My combobox returns two columns of data. I'm storing, in a textbox, the
unbound values. The bound column contains a cryptic foreign key value, the
other column is more friendly to the user. The user needs to see both to be
assured things went well with the selection.

Can we revisit the questions of not being allowed to change the selection
once one is made? My "test" did allow me to change my mind, but in that
test, the combobox was "unbound".

Thanks
Jim
 
Back
Top