• Tab Control (97/2000/2002)

    Author
    Topic
    #381471

    I have a form with a Tab Control. What I would like is as the user enters information throughout the form then clicks the New Record button the Tab Control goes back to the first Tab. I know this may have to be accomplished in code and would appreciate anyones help.

    Thanks
    Tom

    Viewing 2 reply threads
    Author
    Replies
    • #642973

      Just need three lines of code:

      Private Sub cmdNewRecord_Click()
      Me.TabCtl0.Pages(0).SetFocus
      End Sub

      Bob

    • #642976

      You’ve probably got a subform on each tab control, here’s how I set mine up.

      Private Sub Command0_Click()
      Forms!frmMainFormName!sbfSubFormName.SetFocus
      Forms!frmMainFormName!sbfSubFormName!txtFieldName.SetFocus
      DoCmd.GoToRecord , , acNewRec
      End Sub

      Change frmMainFormName to The FormContaining the tabs.
      Change sbfSubFormName to The Form Within the tab.
      Change txtFieldName to the field you want to focus.

      Hope this helps

    • #642993

      You should be able to set the value of the tab control to 0, which is the index value of the first page.

    Viewing 2 reply threads
    Reply To: Tab Control (97/2000/2002)

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

    Your information: