Go to control on subform

G

Guest

I have a form and subform. After updating the combo box on the form, I would
like to have the cursor go to a box on the subform. Right now I have to
click to get down to the subform and would like just to tab to get there.

In the tab order of the form, I have the combo box listed and then the
subform, but the cursor never moves from the combo box on the 1st form, even
when I hit tab or the enter key.
 
R

Roger Carlson

You first have to set the focus to the subform itself, and then set focus to
the control on the subform.

On my website (www.rogersaccesslibrary.com), is a small Access database
sample called "SubformReference.mdb" which illustrates how to do this. Look
at the code behind the "Set the focus to 'TransDate' on Subform1" button.

--
--Roger Carlson
MS Access MVP
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L
 
J

John Vinson

I have a form and subform. After updating the combo box on the form, I would
like to have the cursor go to a box on the subform. Right now I have to
click to get down to the subform and would like just to tab to get there.

In the tab order of the form, I have the combo box listed and then the
subform, but the cursor never moves from the combo box on the 1st form, even
when I hit tab or the enter key.

Odd... it should!

Try putting a bit of code in the combo's AfterUpdate event:

Private Sub cboMyComboBox_AfterUpdate()
Me.Subformname.SetFocus
Me.Subformanme.Form.controlname.SetFocus
End Sub

where "Subformname" is the name of the Subform Control (the box
containing the subform, which might or might not have the same name as
the form within it).

John W. Vinson[MVP]
 

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