Easy SetFocus Question...

N

Nelson

I have a form that has a subform. I need to create a button on the main
form that sets the focus to a particular field on a subform. How do I do
this?

Thanks,
Chris
 
A

Andrew Backer

:) When you figure it out, lemme know! I have this same issue, and I
think I found a solution somewhere. When I got home, I couldn't
remember where it was, and so I still can't do it. Doh!

I have tried just about every normal avenue that I can think of and was
unable to get it to work, but here are some ideas. I don't remember if
I have tried them, but I am going to give it another go tonight.

a) Put a function on the subform and then call it :
me.subFormBlah.Form.SetTheFucus()
b) Try a macro which sets focus, if possible? They seem to work
sometimes

- Andrew Backer
 
K

Ken Snell [MVP]

You need to use two SetFocus steps.....the first to set focus to the subform
control, the second to set focus to the control in the subform:

Me.Subform.SetFocus
Me.Subform!ControlName.SetFocus

where Subform is the name of the subform control (the control that actually
holds the subform object).
 
N

Nelson

Thanks!!!

That Worked!!!!



Ken Snell said:
You need to use two SetFocus steps.....the first to set focus to the subform
control, the second to set focus to the control in the subform:

Me.Subform.SetFocus
Me.Subform!ControlName.SetFocus

where Subform is the name of the subform control (the control that actually
holds the subform object).
 
A

Andrew Backer

And from me too! I've been trying to get this to work for a while, but
I had given up!

- Andrew Backer
 
Top