Results 1 to 5 of 5
  1. #1
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    San Francisco, CA, USA
    Posts
    184
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How do you get out of a field in a subform (2002)

    I have a routine that uses a sendkey statement to insert a number in a field on a subform. I need to get the focus to the mainform to requery the whole form. I tried using select object, open form and explicitly naming a control to go to on the main form with no joy. The cursor stays in the field on the subform.
    Frank Hoeffer

  2. #2
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Brisbane, Queensland, Australia
    Posts
    352
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: How do you get out of a field in a subform (2002)

    Me.Parent.Text2.SetFocus
    David Grugeon
    Brisbane Australia

  3. #3
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    San Francisco, CA, USA
    Posts
    184
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: How do you get out of a field in a subform (2002)

    <img src=/S/bouncenburn.gif border=0 alt=bouncenburn width=31 height=31>
    That did it...thanks!
    I don't quite understand how it works, I know about parent and child forms but am not sure why moving the focus to me!control or the the forms!control commands don't work in this instance.
    Frank

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: How do you get out of a field in a subform (2002)

    Me refers to the container the code is running in. If the code is run in the subform, then Me refers to the subform. If you want to refer to the main (parent) form, you have to use a reference like Me.Parent (or just Parent) to let Access know you're referring to the parent form and its controls.
    Charlotte

  5. #5
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: How do you get out of a field in a subform (2002)

    You can requery the main form without returning the focus to it with
    Me.Parent.Requery
    although you might need to force the saving of the current record first.
    Regards
    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
  •