Results 1 to 5 of 5
  1. #1
    3 Star Lounger
    Join Date
    Aug 2002
    Location
    Brisbane, Queensland, Australia
    Posts
    387
    Thanks
    0
    Thanked 1 Time in 1 Post
    I have a continuous subform in which I've placed a small transparent command button as the last control in the tab order.

    The purpose is to return the focus to a control on the parent form when a user has completed entry of a row in the subform.

    In its on got focus event I have the following code
    Code:
        If IsLoaded("frmSupporter") Then
            Me.Parent!txtSearch = Null
            Me.Parent!txtSearch.SetFocus
        End If
    it puts the focus where I want it but has the unwelcome side effect of locking the subform and I can't see why. I've traced the code and there is nothing in any event that fires during the process - Subform's before or after update etc and can find nothing that should cause this. I've even checked the subform's enables and locked properties in the immediate window and they are as they should be.

    I tried the code in the lost focus of the previous control, the click event of the button and the afterupdate event of the form and it works fine but just doesn't give me the right navigation.

    I tried using a text box instead of the button with the same result so it seems to be the got focus event that is the problem.

    Any ideas, anyone?

  2. #2
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts
    It is nothing to do with your code, because when I replicate the situation you describe, the same thing happens.

    But .as to a solution...Don't know yet.

    I tried putting in a me.parent.setfocus , before setting the focus to the specific control..but that did not make any difference.
    Regards
    John



  3. #3
    3 Star Lounger
    Join Date
    Aug 2002
    Location
    Brisbane, Queensland, Australia
    Posts
    387
    Thanks
    0
    Thanked 1 Time in 1 Post
    Yeah, I tried setting focus to the main form first as well, didn't help.

    Nearest I can get to acceptable behaviour is to use the after update, but if the user is trying to move to a different record in the subform they get a bit of a surprise.

  4. #4
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts
    I just added another line of code to set the focus back to an earlier control on the subform, before moving the focus to the parent, and that seems to fix it..but I don't know why.
    Regards
    John



  5. #5
    3 Star Lounger
    Join Date
    Aug 2002
    Location
    Brisbane, Queensland, Australia
    Posts
    387
    Thanks
    0
    Thanked 1 Time in 1 Post
    John, you are a genius. Works like a charm.

Posting Permissions

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