Moving focus from a parent to a sub form

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

Guest

This ought to be straight forward but Access gives me an error message when using setfocus saying '...cant find the form xxxx referred to in macro or VBA code.....

Does anyone have any ideas why this happens and what I can do to get round it. All I nned to do is move focus from a field populated by a bar scanner to the sub form for data entry/editing.
 
This line will move the focus to the field SomeField in the subform
MySubForm:

Forms!MySubForm.Form!SomeField.SetFocus

When referring to controls in a subform you always have to use the Form
property, because that is not the default property of the subform

Ragnar
 
Back
Top