set focus to last field in a subform (datasheet view)

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
Can someone tell me how to set focus to last grid in a subform
(datasheet)?

I have a form with a subform, when lostfocus on a field in subform, i
update a textbox in the main form by setfocus to the mainform's textbox. i
don't know how to set the focus back to the next field in the subform once
the textbox is updated.


Thanks,
 
Any particular reason that you change the focus to the main form's textbox
just to change its value? Code can change the value without affecting the
focus. Tell us more about what you're wanting to do, and perhaps we can
suggest a simple approach to the entire action.
 
ken,
thx for the reply. yes, i m trying to update a value in main form's
textbox. access gives an error for not setting the textbox on focus when i
change value on the textbox.

jeff
 
Normally, code in a subform to change the value of a main form's textbox
would be this:

Me.Parent.TextBoxName.Value = "MyValue"

It should be unnecessary to set focus to a textbox just to change its
value...unless you're trying to use the Text property? If that is it, don't
use Text..use Value.
 
Hey Jeff, your VB is showing ;-)

The reason you think you need to set the focus is because
you're trying to use the .Text property, The .Value property
does not need the focus. In Access, the Text and Value are
used for different purposes and you really want to use the
Value property. Since it's the default property for
controls, you do not event need to refer to it. Try using
something more like:

Parent.mainformtextbox = Me.subformtextbox
 
Back
Top