Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Jul 2003
    Posts
    124
    Thanks
    0
    Thanked 0 Times in 0 Posts

    SET FOCUS (Access 2002)

    I have a form with a subform; after I'm done entering info in the last field of the form I want the focus to move to this first field of the subform. I tried setting the focus on the after update control on the last field of the form. But I get a Error that states that the subform that I identified does not exist. I used "[Forms].[SubformName].[Field1Name].SetFocus" (Minus the double quotes) on the after update control on the last field of the form.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: SET FOCUS (Access 2002)

    In the first place, a subform is not part of the Forms collection, only main forms are. But you can refer to a subform directly in the code module of the parent form.

    In the second place, when referring to a subform, you must use the name of the subform as a control on the parent form. This is not necessarily the same as the name of the subform in the database window. To view or modify the control name, open the parent form in design view. Click once on the subform - not twice, for then you will select something in the subform. If you happen to click twice by accident, just click somewhere on the parent form outside the subform, then try again. The control name will be displayed in the Other tab of the Properties window (as well as in the title bar of the properties window, and in the Object dropdown list in the Formatting toolbar.

    In the third place, when setting focus to a control on a subform, it takes two instructions: in the first, set focus to the subform, and in the second, set focus to the control on the subform:

    Me.[SubformName].SetFocus
    Me.[SubformName].[ControlName].SetFocus

  3. #3
    2 Star Lounger
    Join Date
    Jul 2003
    Posts
    124
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: SET FOCUS (Access 2002)

    Thanks Again; worked perfectly.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •