Results 1 to 11 of 11
  1. #1
    Join Date
    Oct 2003
    Posts
    24

    Unanswered: slow refresh of form when using large tab control

    hi guys,

    i have a form with a large tab control on it., it has about 60 tabs.
    well, when i change which tabs show with code, it takes several seconds for it to refresh on the screen.
    i am not running a slow pc, it is a 2.4ghz.
    Can any of you think of a way to speed this up ?
    here is one piece of code I am using to do this.
    thanks,
    Please email me at:
    kevin.rea@ngc.com

    -----------------------------------------------------
    Code:
    '-------START routine to set how many bedrooms
        If Me.NumberOfBedrooms = 10 Then
            Me.Page16.Visible = True
            Me.Page15.Visible = True
            Me.Page14.Visible = True
            Me.Page13.Visible = True
            Me.Page12.Visible = True
            Me.Page11.Visible = True
            Me.Page10.Visible = True
            Me.Page09.Visible = True
            Me.Page08.Visible = True
            Me.Page07.Visible = True
    
    ElseIf Me.NumberOfBedrooms = 9 Then
            Me.Page16.Visible = False
            Me.Page15.Visible = True
            Me.Page14.Visible = True
            Me.Page13.Visible = True
            Me.Page12.Visible = True
            Me.Page11.Visible = True
            Me.Page10.Visible = True
            Me.Page09.Visible = True
            Me.Page08.Visible = True
            Me.Page07.Visible = True
    
    ElseIf Me.NumberOfBedrooms = 8 Then
            Me.Page16.Visible = False
            Me.Page15.Visible = False
            Me.Page14.Visible = True
            Me.Page13.Visible = True
            Me.Page12.Visible = True
            Me.Page11.Visible = True
            Me.Page10.Visible = True
            Me.Page09.Visible = True
            Me.Page08.Visible = True
            Me.Page07.Visible = True
    
    ElseIf Me.NumberOfBedrooms = 7 Then
            Me.Page16.Visible = False
            Me.Page15.Visible = False
            Me.Page14.Visible = False
            Me.Page13.Visible = True
            Me.Page12.Visible = True
            Me.Page11.Visible = True
            Me.Page10.Visible = True
            Me.Page09.Visible = True
            Me.Page08.Visible = True
            Me.Page07.Visible = True
    
    ElseIf Me.NumberOfBedrooms = 6 Then
            Me.Page16.Visible = False
            Me.Page15.Visible = False
            Me.Page14.Visible = False
            Me.Page13.Visible = False
            Me.Page12.Visible = True
            Me.Page11.Visible = True
            Me.Page10.Visible = True
            Me.Page09.Visible = True
            Me.Page08.Visible = True
            Me.Page07.Visible = True
    
    ElseIf Me.NumberOfBedrooms = 5 Then
            Me.Page16.Visible = False
            Me.Page15.Visible = False
            Me.Page14.Visible = False
            Me.Page13.Visible = False
            Me.Page12.Visible = False
            Me.Page11.Visible = True
            Me.Page10.Visible = True
            Me.Page09.Visible = True
            Me.Page08.Visible = True
            Me.Page07.Visible = True
    
    ElseIf Me.NumberOfBedrooms = 4 Then
            Me.Page16.Visible = False
            Me.Page15.Visible = False
            Me.Page14.Visible = False
            Me.Page13.Visible = False
            Me.Page12.Visible = False
            Me.Page11.Visible = False
            Me.Page10.Visible = True
            Me.Page09.Visible = True
            Me.Page08.Visible = True
            Me.Page07.Visible = True
        
    ElseIf Me.NumberOfBedrooms = 3 Then
            Me.Page16.Visible = False
            Me.Page15.Visible = False
            Me.Page14.Visible = False
            Me.Page13.Visible = False
            Me.Page12.Visible = False
            Me.Page11.Visible = False
            Me.Page10.Visible = False
            Me.Page09.Visible = True
            Me.Page08.Visible = True
            Me.Page07.Visible = True
        
    ElseIf Me.NumberOfBedrooms = 2 Then
            Me.Page16.Visible = False
            Me.Page15.Visible = False
            Me.Page14.Visible = False
            Me.Page13.Visible = False
            Me.Page12.Visible = False
            Me.Page11.Visible = False
            Me.Page10.Visible = False
            Me.Page09.Visible = False
            Me.Page08.Visible = True
            Me.Page07.Visible = True
        
    ElseIf Me.NumberOfBedrooms = 1 Then
            Me.Page16.Visible = False
            Me.Page15.Visible = False
            Me.Page14.Visible = False
            Me.Page13.Visible = False
            Me.Page12.Visible = False
            Me.Page11.Visible = False
            Me.Page10.Visible = False
            Me.Page09.Visible = False
            Me.Page08.Visible = False
            Me.Page07.Visible = True
        
    ElseIf Me.NumberOfBedrooms = 0 Or Me.NumberOfBedrooms = Null Then
            Me.Page16.Visible = False
            Me.Page15.Visible = False
            Me.Page14.Visible = False
            Me.Page13.Visible = False
            Me.Page12.Visible = False
            Me.Page11.Visible = False
            Me.Page10.Visible = False
            Me.Page09.Visible = True
            Me.Page08.Visible = True
            Me.Page07.Visible = True
    End If
    '-------END routine to set how many bedrooms

  2. #2
    Join Date
    May 2004
    Posts
    4
    You may try to stick it in a control for next loop ie:-

    Dim CurControl as Control, f as integer

    If Me.NumberOfBedrooms = 10 Then
    For f = 7 to 16
    CurControl = Form!TheFormName("Page" & f)
    CurControl.Visible = True
    Next

    you'd have to take the leading '0' out of the page names


    might shave a bit of time

    regards


    Nick

  3. #3
    Join Date
    Oct 2003
    Posts
    24

    i get an error with that.

    Hi Nick,

    thanks for the help.

    I put in the following code, and I get this error..
    "Property let procedure not defined and property get procedure did not return an object."

    I think it wants me to create a collection, but i am still pretty new to this, and I do not understand what to do at this point.

    Any ideas ?

    here is the code I was using.
    Code:
    Private Sub NumberOfBedrooms_AfterUpdate()
        
        Dim CurControl As Control, f As Integer
    
        If Me.NumberOfBedrooms = 2 Then
        For f = 7 To 9
        CurControl = Form!TabCtl88("Page" & f)
        
        CurControl.Visible = True
        Next
    
    
    End If
    
    End Sub
    Last edited by kevinrea; 05-25-04 at 13:24.

  4. #4
    Join Date
    Mar 2004
    Location
    Nashville, TN
    Posts
    557
    If the form is currenty the active form I would put the following code, and see what happens.

    Code:
    Private Sub NumberOfBedrooms_AfterUpdate()
        
        Dim CurControl As Control, f As Integer
    
        If Me.NumberOfBedrooms = 2 Then
        For f = 7 To 9
        CurControl = Me("Page" & f)
        
        CurControl.Visible = True
        Next
    
    
    End If
    I hope that helps,
    JS
    End Sub
    Have you ever thought about thinking on purpose?

    Jarvis Stubblefield
    Patriot Designs
    Web/Database Development and Consulting
    The-Patriot.net by Patriot Designs

  5. #5
    Join Date
    Oct 2003
    Posts
    24

    another error

    Hi,

    I put that code in..
    and I now get this error.
    "Object variable or With block variable not set"

    It pointed to the line:
    Code:
    CurControl = Me("Page" & f)
    I then changed the
    Code:
    CurControl = Me("Page" & f)
    to
    Code:
    CurControl = Me.TabCtl88("Page" & f)
    but it did not like that either..
    any ideas ?

    kevin
    ps..thank you very much for your help on this.

  6. #6
    Join Date
    Mar 2004
    Location
    Nashville, TN
    Posts
    557
    What is TabCt188?

    Not a problem I hope we get this resolved for you,
    JS
    Have you ever thought about thinking on purpose?

    Jarvis Stubblefield
    Patriot Designs
    Web/Database Development and Consulting
    The-Patriot.net by Patriot Designs

  7. #7
    Join Date
    Apr 2004
    Location
    Kingsland, Georgia
    Posts
    231
    "Object variable or With block variable not set" means you have to set your object to something. try using
    Code:
    set CurControl = Me("Page" & f)
    good luck
    what you did wa create a reference to an object, but didn't set it to actually point to one.

  8. #8
    Join Date
    Oct 2003
    Posts
    24

    well,

    TabCtl88 is the name of my tab control.

  9. #9
    Join Date
    Apr 2004
    Location
    Kingsland, Georgia
    Posts
    231
    Of course. Sorry. so
    Code:
    set CurControl = TabCtl88
    you can reference a page by
    Code:
    CurControl.Pages(pagenumber-1)
    reason for the -1 is that arrays are based at 0. so tab 7 would be page 6. lemme know what else you need.

    p.s. i just re-read your original post...i have some work to do right quick-like and then i'll put you a loop together. if no one else does first, that is. later

  10. #10
    Join Date
    Oct 2003
    Posts
    24

    take a look

    Hi Guys,

    still having problems.

    i will upload the program here..take a look.
    where we want to look is in the form called "INSPECTIONMAIN"

    look under the field named "NumberOfBedrooms", in
    it's AfterUpdate section:
    that is where we would put the code you have been giving me.
    I have put the stock code back in that i had so you can see how it works.

    It also runs this code for the forms event "CurrentRecord", so you can see how slow this thing refreshes.
    This is a program I am writing for my home inspection business.
    Attached Files Attached Files
    Last edited by kevinrea; 05-25-04 at 15:35.

  11. #11
    Join Date
    Apr 2004
    Location
    Kingsland, Georgia
    Posts
    231
    not sure if you're interested, but if you still need a loop,
    Code:
        Dim MaxNumBedrooms As Integer
        Dim NumBed As Integer
        Dim ctl As Control
        
        Set ctl = TabCtl88
        
        NumBed = Me.NumberOfBedrooms
        MaxNumBedrooms = 10
    
        Do While MaxNumBedrooms > Me.NumberOfBedrooms
            ctl.Pages(MaxNumBedrooms).Visible = False
            count = count - 1
        Loop
    
        set ctl = Nothing  'release resources

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •