Refer to several tab pages

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • fsivas
    New Member
    • Oct 2008
    • 2

    Refer to several tab pages

    Hi!
    I´m working in a database in Microsoft Office Access 2003 with Microsoft Visual Basic 6.5. I have 8 Tabs in a form.

    I´m just wondering if there is a better way to reduce this lines:
    Code:
    ChildTop = 3100
    ChildLeft = 9000
    ChildWidth = 8000
    ChildHeight = 5200
    Me.Page1Child.Top = ChildTop
    Me.Page1Child.Left = ChildLeft
    Me.Page1Child.Width = ChildWidth
    Me.Page1Child.Height = ChildHeight
    Me.Page2Child.Top = ChildTop
    Me.Page2Child.Left = ChildLeft
    Me.Page2Child.Width = ChildWidth
    Me.Page2Child.Height = ChildHeight
    Me.Page3Child.Top = ChildTop
    Me.Page3Child.Left = ChildLeft
    Me.Page3Child.Width = ChildWidth
    Me.Page3Child.Height = ChildHeight
    Me.Page4Child.Top = ChildTop
    ...
    Last edited by NeoPa; Oct 12 '08, 11:01 PM. Reason: Please remember to use the [CODE] tags provided
  • DonRayner
    Recognized Expert Contributor
    • Sep 2008
    • 489

    #2
    You would be better off taking this question over to the Visual Basic Form.

    Comment

    • NeoPa
      Recognized Expert Moderator MVP
      • Oct 2006
      • 32654

      #3
      I'm not sure Don.

      This is presumably a VBA form object we're talking about.

      The answer rather depends on there being some sort of pages collection. Let me see what I can find.

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32654

        #4
        Try this :
        Code:
        Dim ctl As Control
        
        ChildTop = 3100
        ChildLeft = 9000
        ChildWidth = 8000
        ChildHeight = 5200
        
        For Each ctl In Me.Controls
          If ctl.ControlType = 124 Then
            ctl.Top = ChildTop
            ctl.Left = ChildLeft
            ctl.Width = ChildWidth
            ctl.Height = ChildHeight
          End If
        Next ctl
        The ControlType value of 124 indicates a Page control of course.

        Comment

        • DonRayner
          Recognized Expert Contributor
          • Sep 2008
          • 489

          #5
          Originally posted by NeoPa
          I'm not sure Don.

          This is presumably a VBA form object we're talking about.

          The answer rather depends on there being some sort of pages collection. Let me see what I can find.
          Sorry about that NeoPa, it's just that I find that much of what works in VBA doesn't translate quite as you think it should over to Visual Baisc 6.

          Don

          Comment

          • NeoPa
            Recognized Expert Moderator MVP
            • Oct 2006
            • 32654

            #6
            No apology necessary Don. It wasn't too clear - although the OP obviously did their best to be specific.

            My solution will probably only work for an Access form. If it turns out to be a VB one, then they'll need to follow your advice anyway ;)

            Comment

            Working...