Disable ENTER key in Combo Box

J

jschping

Hi,

I have a combo box in a form linked to a field in a query.

I want the user to be able to click with the mouse in the combo box to pick
a value, then go to other fields in the form to enter data. I have a "SAVE"
button to save all the fields in the form.

However, I have found that if I click in the combo box a value, then hit
ENTER (like I can do sometimes in a web browser) it actually commits the
value to the table!!

How do I disable this so hitting Enter does nothing in the combo box? I
tried going to the OnEnter event, but have no clue what to code there.

Thanks!!

jschping
 
R

Rick Brandt

jschping said:
Hi,

I have a combo box in a form linked to a field in a query.

I want the user to be able to click with the mouse in the combo box to
pick a value, then go to other fields in the form to enter data. I have a
"SAVE" button to save all the fields in the form.

However, I have found that if I click in the combo box a value, then hit
ENTER (like I can do sometimes in a web browser) it actually commits the
value to the table!!

How do I disable this so hitting Enter does nothing in the combo box? I
tried going to the OnEnter event, but have no clue what to code there.

There is nothing about pressing <Enter> that by itself should save the
record.

If the ComboBox is last in the TabOrder and you have the Form's Cycle
property set to "All Records" then the save is actually happening because
you are moving to the next record. Just change the Cycle property to
Current Record.
 
J

Jeff Boyce

From your description and question, you've determined that saving the value
is undesirable.

Why? What are you unable to do because Access has already saved a
value/record?

Is your form bound to a dataset, or are you using an unbound form?

More info, please...

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.
 
J

jschping

Hi,

The form is bound to the query and the combo box to one of the fields in the
query.

Thanks!
 
J

jschping

Hi,

I changed the property in the Form. It does stop me from Tabbing through to
the next form, but the ENTER key WILL still go to the next record! Any idea
how to stop that?

Thanks!!
 
J

jschping

Hi,

I followed your advice. It did work to stop the Tab button from moving to
the next record. But the ENTER key WILL still go to the next record and I
don't want the user to be able to do that.

Any ideas how I can make this happen?

Thanks!!
 
J

jschping

Hi,

I'm using a form that's bound to a query. The controls are directly bound to
fields in the query, and thus changing them will directly affect the values
in the table.

I don't want the user to commit the changes and be able to navigate to the
next form unless they use the combo box I created to do that. I also have a
button to save the changes to the table. I don't want the ENTER key to be
able to do that.

I changed the value of Navigation for the ENTER key in the Advanced Options
in Access. But I don't think that will carry over to another user with their
own personal settings. So I need to hard code it into the form.

Thanks!!!!

John Schping
 

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

Similar Threads


Top