place cursor in datasheet subform based on query

G

gator

ok, I found this, which highlights the cell but does not give focus where I
can start typing...Any ideas what can be added to allow typing without
clicking in the cell?

Dim frm As Form
Dim ctl As Control

Set frm = Me!SubFormControl.Form
Set ctl = frm.txtControl3

frm.Recordset.MoveLast
ctl.SetFocus

Set frm = Nothing
Set ctl = Nothing
--
Dave Hargis, Microsoft Access MVP




 
G

gator

this worked....

No, that's right.

Each form has an active control. For the user to experience the sub-subform
control as the one that has the focus, you need to do all these:
- make cmbTemp the active control in the sub-subform,
- make the frmOxygen1 subform control the active control in the middle form,
- make frmCalibration2 subform control the active control in the main form.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Silvio said:
Hello is there a way to simplify the 3 lines of codes below to set focus
from
the main form to a control in subform2?

Me.frmCalibration2.SetFocus 'Subform 1
Me.[frmCalibration2].Form![frmOxygen1].SetFocus 'Subform 2
Me.[frmCalibration2].Form![frmOxygen1].Form![cmbTemp].SetFocus 'Set focus
on
cmbTemp

Thank you,
Silvio
 

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