Results 1 to 5 of 5
  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Vancouver, Br. Columbia, Canada
    Posts
    632
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Strange behaviour - menus (2003)

    I have an application that's worked well for over 8 years. In the last week, the forms' performace have slowed down to the point of unusability on my main computer (Vista Home Premium). The behaviour was not present on my secondary machine (WinXP Pro). The mouse cursor would freeze, "Calculating..." would display in the status bar for 10-15 seconds when moving between records, windows would resist being moved, etc. Slow behaviour was even present when working with the actual (linked) tables. The frontend and backend are both on the local drive on this development computer. No other databases (including the backend) were affected.

    The frontend and backend are A2000 format, running in A2003. The application had been converted from A97.

    Finally traced it down to a section of code that constructed a menu using the Office 11 component. When I comment-out the call to BuildMenu, it worked properly. That's the workaround I've used -- just avoid calling the BuildMenu procedure when running on this computer. I haven't changed the code in this section of the application in years, and I am fairly certain that nothing else I did would cause this behaviour. Any idea what is causing it?


    Private Sub buildMenu()
    Dim ToolsIndex As Integer
    Dim NewMenu As Variant

    'To remove
    On Error Resume Next
    Application.CommandBars("Menu Bar").Controls("LODM").Delete

    ToolsIndex = Application.CommandBars("Menu Bar").Controls("Tools").Index
    Set NewMenu = Application.CommandBars("Menu Bar").Controls.Add _
    (Type:=msoControlPopup, Before:=ToolsIndex, temporary:=True)
    NewMenu.Caption = "&LODM"

    AddMenuItem NewMenu, "Customers", False, "=Openform('aFrmCustomer')"
    AddMenuItem NewMenu, "Tanks", False, "=Openform('aFrmTankDetails')"
    AddMenuItem NewMenu, "Estimate", False, "=Openform('frmEstimateFutureInventories')"
    AddMenuItem NewMenu, "Trip", False, "=Openform('frmTripSummary')"
    AddMenuItem NewMenu, "Tank Analysis", True, "=Openform('ufrmSelectTanksToAnalyzeConsumptio n')"
    AddMenuItem NewMenu, "Delivery Analysis", False, "=Openform('frmDeliveryAnalysis')"
    AddMenuItem NewMenu, "Inventory Update", False, "=Openform('uFrmUpdateInventory')"
    AddMenuItem NewMenu, "Main menu", True, "=Openform('@frmMain')"
    AddMenuItem NewMenu, "About", False, "=Openform('uSysAbout')"

    End Sub

    Public Sub AddMenuItem(vMenu As Variant, _
    psCaption As String, pbBegin As Boolean, psAction As String)

    Dim ctl As CommandBarControl

    Set ctl = vMenu.Controls.Add(Type:=msoControlButton, temporary:=True)
    With ctl
    .BeginGroup = pbBegin
    .Caption = psCaption
    .FaceId = 0
    .OnAction = psAction
    .Visible = True
    End With

    End Sub
    --------------------------------------------------
    Jack MacDonald
    Vancouver, Canada

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Strange behaviour - menus (2003)

    There's nothing in the code that catches my eye.

    Do you have other Office applications (in Word, Excel, Access) that use code to create commandbars? If so, do they show the same behavior on the Vista machine? If not, could you create a small application to test this?

  3. #3
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Vancouver, Br. Columbia, Canada
    Posts
    632
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Strange behaviour - menus (2003)

    Good idea. I will add the code to another Access project and see what happens. Will let you know the outcome.
    --------------------------------------------------
    Jack MacDonald
    Vancouver, Canada

  4. #4
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Vancouver, Br. Columbia, Canada
    Posts
    632
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Strange behaviour - menus (2003)

    Found the answer...
    The frontend is A2000 format, running under A2003 on my computers. When used on a Vista machine, it exhibits the problem with sluggish performance. It works fine when used on XP. It also works fine when the frontend is converted to A2003 format.

    I converted the old application from A97 to A2000 because I thought it would be the best common format for all the machines used at the clients worksite. Time to re-evaluate that decision! My understanding is that the preferred format for backend is A2000 regardless of the frontend format

    (Aside: I enabled the menus and saw the sluggish performance. Then disabled the menu in code and closed the frontend manually WITHOUT using code to remove the menu. Re-opened the frontend (with the menu-code disabled). Performance was now at proper level -- not sluggish. It appears to be the *creation* of the menu, not the *presence* of the menu that is causing the sluggish performance.)
    --------------------------------------------------
    Jack MacDonald
    Vancouver, Canada

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Strange behaviour - menus (2003)

    Another minus for Vista, I guess...

Posting Permissions

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