Results 1 to 6 of 6
  1. #1
    ProvPC is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jun 2016
    Posts
    37

    Tab Control Button to Start a New Record and Return to First Tab

    I have a form that uses a tab control with three tabs. Thanks to information I've been able to gather from other threads, I've been able to create buttons at the bottom of the first tab to move the second tab, and again to move from the second tab to the third.



    What I'd like to be able to do is create a button on the third tab that submits the record (or, I suppose, starts a new record) and shifts the user back to the first tab to begin again.

    If it matters at all, this is how I'm advancing the between the tabs (I'll name it correctly when I have it all working):

    Private Sub Command73_Click()
    Me.ERG_TabCtrl.Value = ERG_TabCtrl.Value + 1
    End Sub

  2. #2
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2013 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Do the same as what you did for the others - set the value to 0 and start a new record (DoCmd.GoToRecord,,acNewRec).

  3. #3
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,474
    Maybe also set focus to the first field in Tab1 after saving?

    Me.yourfield.Setfocus

  4. #4
    ProvPC is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jun 2016
    Posts
    37
    Quote Originally Posted by aytee111 View Post
    Do the same as what you did for the others - set the value to 0 and start a new record (DoCmd.GoToRecord,,acNewRec).
    Thank you - that worked perfectly!

  5. #5
    ProvPC is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jun 2016
    Posts
    37
    Quote Originally Posted by Bulzie View Post
    Maybe also set focus to the first field in Tab1 after saving?

    Me.yourfield.Setfocus
    This is a great idea, and something I hadn't even thought about! I tried adding this to the script, but I think I must have done something incorrectly. Here's what I have:

    Me.ERG_TabCtrl.Value = ERG_TabCtrl.Value = 0
    DoCmd.GoToRecord,,acNewRec
    Me.HoHFirstName.Setfocus

    HoHFirstName is the name of the first field on the first tab of the form. The error I receive is:

    Compile error:
    Method or data member not found

    As it happens, removing that line from the script altogether submits the record, and moves me to the first tab with the focus on the first field already, so it worked out splendidly. Thanks for your suggestion!

  6. #6
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,474
    Yeah you might have needed to use the full path to reference the field like Forms!frmMain!HoHFirstName.SetFocus but if it works regardless that's even better.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Return Start & Stop Times by Date
    By smc1155 in forum Queries
    Replies: 3
    Last Post: 01-24-2016, 06:46 PM
  2. Replies: 13
    Last Post: 04-29-2015, 09:24 AM
  3. Replies: 2
    Last Post: 11-14-2014, 03:07 PM
  4. Replies: 9
    Last Post: 08-19-2014, 12:41 PM
  5. Replies: 7
    Last Post: 06-12-2012, 08:56 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums