• Strange subform behaviour

    Author
    Topic
    #470404

    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?

    Viewing 3 reply threads
    Author
    Replies
    • #1234833

      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.

    • #1234834

      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.

    • #1234835

      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.

    • #1234837

      John, you are a genius. Works like a charm.

    Viewing 3 reply threads
    Reply To: Strange subform behaviour

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: