Results 1 to 4 of 4
  1. #1
    Lounger
    Join Date
    Jan 2001
    Location
    Indiana
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Setting focus in a subform (Access 2000 SR1a)

    Question on setfocus: I have a tab control on my main form where each tab contains a subform. When my user exits (tabs or enters) from the last field I would like the focus to go to the first field in the subform on the first tab. This is what I tried but it only sets the focus to the tab not the field in the subform

    Private Sub Designer_LostFocus()
    'Move Cursor to Plant Subform
    frmProposalPlant!ItemQty.SetFocus

    End Sub

    frmProposalPlant is the name of the subform and ItemQty is the name of the first field on the subform. One other thing to note is the subform is a continuous form.

    Thanks in advance
    Tom

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

    Re: Setting focus in a subform (Access 2000 SR1a)

    Try setting focus to the subform first, then to the control in the subform:

    frmProposalPlant.SetFocus
    frmProposalPlant!ItemQty.SetFocus

    This should set focus to the ItemQty field, but if you have visited the subform previously, the focus will remain in the record that was current before.

    If you want the first record to become active, add an instruction:

    RunCommand acCmdRecordsGotoFirst

  3. #3
    Lounger
    Join Date
    Jan 2001
    Location
    Indiana
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Setting focus in a subform (Access 2000 SR1a)

    That worked beautifully. Thank you
    Tom

  4. #4
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Setting focus in a subform (Access 2000 SR1a)

    Hi Tom

    You may to look at this for future reference

    Dev Ashish has the best table I've seen for trying to figure out sub and sub-sub form controls and such: Refer to Form and Subform properties and controls. In addition to a great description, you can download the table as a Word document. You'll want to save that for future reference

    http://www.mvps.org/access/forms/frm0031.htm

    HTH

    JOhn

Posting Permissions

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