Set Focus within the subform?

M

MLD

not sure if this should be going to the Forms group, but here goes.
I have a form/subform which when opened, needs to begin editing in the first
field of the subform dispalyed as a data table. What is the correct way to
SetFocus on this field? My tab order in the sub is correct, but I can't get
it to properly select on open.

Thanks,
-Monica
(e-mail address removed)
 
J

jl5000

Try this in the On Open Event of the main form:

Private Sub Form_Open(Cancel As Integer)
Me.My_sub_frm.SetFocus
Me.My_sub_frm("MyControlName").SetFocus
End Sub
 
S

SacCourt

I might use the on current event for the form.

[Form_YourFormName]![YourFieldName].setfocus

Sometimes in code.

[Form_MainFormName]![Subform]![YourFiled].setfocus

me!subform!field.setfocus is almost equivalent
 

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