Results 1 to 5 of 5
  1. #1
    3 Star Lounger
    Join Date
    Nov 2001
    Location
    Sydney, New South Wales, Australia
    Posts
    216
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Cursor Return (XP SP2)

    I have a main form with a tab control which has half a dozen tabs. Each tab contains a sub-form relating to the main form. On the main form is a find record combo box so that I can find a main form record then edit related data in each of the sub-forms. A couple of the sub-forms have their own data entry combos which need refreshing when the main form record changes. That is, when I use one of the combos on a sub-form, I am able to see and use choices relating to the main form. To do that, I have code which set focus to each sub-form and the combo box on each one in turn then requeries the combo box.

    The problem is, the cursor always ends up in a different sub-form.

    Is there a way to return the cursor from whence it came when I used the find combo box?

    Thanks

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

    Re: Cursor Return (XP SP2)

    I'm not sure I understand the problem. You do know, don't you, that it isn't necessary to set the focus to those controls or subforms to requery them?
    Charlotte

  3. #3
    3 Star Lounger
    Join Date
    Nov 2001
    Location
    Sydney, New South Wales, Australia
    Posts
    216
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Cursor Return (XP SP2)

    No I wasn't aware of that. I always thought the control had to have focus in order to requery it.

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

    Re: Cursor Return (XP SP2)

    No, you simply have to use the correct syntax in referring to it. In Access, you can reference a subform control (the subform you dropped on the parent form is in a subform control) from the parent form like this (where subformcontrol represents the name of the subform control on the parent form):

    Me!subformcontrol.Requery

    If you want to requery a particular control on a subform, it would be:

    Me!subformcontrol.Form!controlname.Requery

    Note that the subform control is not the same as the subform it contains. They may have the same name or different names, but when you refer to the control, you use the subform control name, not the name of the subform object itself. In versions of Access later than 97, you can skip the reference to the Form property when referring to a control on a subform (represented here by controlname), but it doesn't hurt to use it, and you still need it if you are referring to some other method or property of the subform.
    Charlotte

  5. #5
    3 Star Lounger
    Join Date
    Nov 2001
    Location
    Sydney, New South Wales, Australia
    Posts
    216
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Cursor Return (XP SP2)

    Yup. It works, of course!
    Thanks a million.
    Nick

Posting Permissions

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