Results 1 to 11 of 11
  1. #1
    dwif is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2013
    Posts
    6

    Add new page using button in tab control

    Hi,



    I have this sample form using tab control http://i.stack.imgur.com/nOTkO.png
    There is "+" button next to first tab. Click that button, and new tab will appear including the contents.
    It's like copying all contents in tab1 to the new one. Is there someone know how to make it?

    I'm thinking using hide and show tab. But I don't know how to put that "+" button always next to last tab.
    Thanks
    Regards,
    Dwi

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    All you have is a picture of a form - not an actual db with that form? I have never seen anything like that behavior.

    What do you mean by 'copying all the contents in tab1 to the new one'? Why would contents be copied to another tab?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    dwif is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2013
    Posts
    6
    Quote Originally Posted by June7 View Post
    All you have is a picture of a form - not an actual db with that form? I have never seen anything like that behavior.

    What do you mean by 'copying all the contents in tab1 to the new one'? Why would contents be copied to another tab?
    Yes, I didn't attached the db because I just need the design layout using tab control. Focus only to the tab.
    Imagine blank form with design like my sample. No dependency with any data.

    In tab 1 there are view components : label, text field, button etc
    When I click "+", all that component will copied into new tab (example : tab 2)

    I got that picture from somewhere and for some reasons, I can't ask to that person who made it.
    So I know that maybe possible to make it. Just don't know how

    Do you have any idea June7?

  4. #4
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    It sounds like you're talking about adding a New Record with the same data from the Current Record, i.e. you want to enter a new recipe, starting out with the ingredients from the previous recipe; is that the case?

    Linq ;0)>

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Are you saying the result of clicking the '+' would be more than 1 tab displayed, each showing ingredients? That makes no sense to me. Just not enough understanding of data structure and form behavior you want to offer specifics.

    Only 15 calories per serving - some miracle recipe! The cooking instructions shown don't fit the recipe.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    dwif is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2013
    Posts
    6
    Quote Originally Posted by Missinglinq View Post
    It sounds like you're talking about adding a New Record with the same data from the Current Record, i.e. you want to enter a new recipe, starting out with the ingredients from the previous recipe; is that the case?

    Linq ;0)>
    Hi Linq,

    Thank you for your reply.
    Actually the data could be different, I just need to duplicate the form within tab control.
    Is that possible?

  7. #7
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    The usual approach to 'adding' Tabbed Pages is to make them part of your design and then control their Visibility, making a Page Visible to 'add' it.

    How many times do you anticipate doing this; twice, three times, one hundred times?

    What, in plain language, is the underlying task you're trying to perform, here?

    Linq ;0)>

  8. #8
    dwif is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2013
    Posts
    6
    Quote Originally Posted by Missinglinq View Post
    The usual approach to 'adding' Tabbed Pages is to make them part of your design and then control their Visibility, making a Page Visible to 'add' it.

    How many times do you anticipate doing this; twice, three times, one hundred times?

    What, in plain language, is the underlying task you're trying to perform, here?

    Linq ;0)>
    Yes, underlying task if it's possible.
    If not, I thought the same as you, control visibility.
    I need to make 10 pages, 5 page at first, and the rest visible only if I click "+" button one by one.
    I think it's easier.

    Btw, how to rename page caption based on page order?
    Example :
    There are 5 pages with visibility = true
    Caption for each page : Group 1, Group 2, Group 3, Group 4, Group 5

    When I hide Group 1.
    Group 2 will be first tab, and rename to Group 1.

    I hope I explained it well
    Thank you

  9. #9
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    You would not rename the pages of the tab control, but would change the Caption property. This could get complicated.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  10. #10
    dwif is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2013
    Posts
    6
    Quote Originally Posted by June7 View Post
    You would not rename the pages of the tab control, but would change the Caption property. This could get complicated.
    Yes, I tried something like this to add new page from "+" button

    Code:
    Private Sub GroupTab_Change()  Dim i As Integer
      Dim intCounter As Integer
      Dim arrCount(1 To 10) As Long
      Dim max As Integer
      Dim nextpage As Integer
    
    
      cnt = Me.GroupTab.Pages.Count
      intCounter = 1
      For i = 1 To cnt
        If Me.GroupTab.Pages(i - 1).Visible = True And Me.GroupTab.Pages(i - 1).Caption <> "+" Then
           arrCount(intCounter) = i - 1
           intCounter = intCounter + 1
        End If
      Next i
      
      max = 0
      For i = 1 To intCounter
        If Not IsNull(arrCount(i)) Then
         max = max + 1
        End If
      Next i
      
      nextpage = Me.GroupTab.Value + 1
      
      Me.GroupTab.Pages(nextpage).Visible = True
      Me.GroupTab.Pages(nextpage).Caption = "+"
      Me.GroupTab.Pages(Me.GroupTab.Value).Caption = "Group " & max
    
    
      
    End Sub
    It works for now

  11. #11
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Congratulations! Not as complicated as I feared.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 7
    Last Post: 05-25-2013, 11:48 AM
  2. Tab Control Page Backcolor
    By RayMilhon in forum Access
    Replies: 1
    Last Post: 04-22-2013, 02:49 PM
  3. Control Page Headers with VBA?
    By FL_Boy in forum Reports
    Replies: 3
    Last Post: 12-22-2011, 03:49 PM
  4. Show page on tab from control on subform
    By jpkeller55 in forum Access
    Replies: 1
    Last Post: 01-24-2011, 07:55 AM
  5. Multiple Control Box on Page
    By nkenney in forum Forms
    Replies: 2
    Last Post: 10-26-2009, 10:37 AM

Tags for this Thread

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