• Tab Control (Access 2K)

    Author
    Topic
    #382750

    I have a form with a tab control on it and a cancel button to the side. When the form opens only the first tab is visible and I collect some transactional information such as entry date before making the other tabs visible. The code for this is:

    Me!tabCharge.Visible = True
    DoCmd.GotoControl “tabCharge” ‘ to bring that tab to the front then
    DoCmd.GotoControl “btnCancel” ‘ to move the focus onto the Cancel button.

    The last line fails but I don’t understand why. I need to move the focus after making the tab visible as otherwise it goes to one of the fields on the tab and exiting from that field causes the checking code attached to it to fail.

    Does anyone know how to make a tab visible and to the front without moving the focus to it?

    David Parton

    Viewing 0 reply threads
    Author
    Replies
    • #649982

      I assume that tabCharge is the name of one of the pages of the tab control. I don’t know what the name of the tab control itself is. You might try code like this:

      tabCharge.Visible = True
      tabControlName.Value = 2 ‘ Zero-based index of tab to activate
      btnCancel.SetFocus

      Replace tabControlName by the name of your tab control. The Value of a tab control is the zero-based index of the active tab, so the first tab has index 0, the second has index 1 etc. The above example would activate the third tab.

    Viewing 0 reply threads
    Reply To: Tab Control (Access 2K)

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

    Your information: