Command Button

C

Chuck216

Hi

I have a form with a textbox on it and 2 command buttons (a cancel and an OK
button). Is it possible to keep the OK command button active so that when a
user finishes entering text in the textbox all they have to do is hit enter
and it clicks the OK command button?

Thanks in advance for any help with this.
Chuck
 
J

Jeff Boyce

Chuck

Depends on what you mean by "keep...active". Access will treat the control
with the focus as the "active" control, so "no, not exactly". On the other
hand, you could specify the <OK> command button as the default command
button on the form. That might just be what you're looking for...

--
Regards

Jeff Boyce
www.InformationFutures.net

Microsoft Office/Access MVP


Microsoft IT Academy Program Mentor
http://microsoftitacademy.com/
 
D

Dale Fye

Chuck

You could also just call the command buttons click event from the after
update event of the text box. Something like:

Private Sub txt_YourControlName_AfterUpdate

Call Forms_YourFormName_Click

END SUB

HTH
Dale
 
C

Chuck216

That was it setting it as default! Thank you



Jeff Boyce said:
Chuck

Depends on what you mean by "keep...active". Access will treat the control
with the focus as the "active" control, so "no, not exactly". On the other
hand, you could specify the <OK> command button as the default command
button on the form. That might just be what you're looking for...

--
Regards

Jeff Boyce
www.InformationFutures.net

Microsoft Office/Access MVP


Microsoft IT Academy Program Mentor
http://microsoftitacademy.com/
 

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