joerobbins
Programmer
Problem: Office widgets in VBA OK in Access97 but EXTREMELY slow in Access2000
The code below when run from function test() ON THE SAME MACHINE produces:
Using Acess97 (less than 1 second)
BOJ: 17/01/03 15:19:47 EOJ: 17/01/03 15:19:47
Using Access2000 (horrendous 20 seconds)
BOJ: 17/01/03 15:18:03 EOJ: 17/01/03 15:18:23
Both use Reference: Microsoft Office 9.0 Object Library
Access VBA code module fragment [this test simplifies actual application] :
Option Compare Database
Option Explicit
Public TestCommandBar As Office.commandBar
Private cboTest As Office.CommandBarComboBox
Public Function test()
Dim boj As Date, eoj As Date
Dim cbar As Office.commandBar
Set TestCommandBar = CommandBars.Add("BCStest", msoBarTop, , True)
Set cboTest = TestCommandBar.Controls.Add(msoControlDropdown)
With cboTest: .width = 150: .DropDownWidth = 200: .BeginGroup = True
.OnAction = "=pingCboTest()"
End With
boj = Now()
makeCboTest
TestCommandBar.Visible = True
eoj = Now()
Debug.Print "BOJ: " & boj & " EOJ: " & eoj
End Function
Public Function makeCboTest()
Dim ix As Integer
cboTest.Clear
For ix = 1 To 100
cboTest.AddItem "Entry" & ix ' THIS LINE TAKES ALL THE TIME
Next
cboTest.Enabled = True
End Function
Public Function pingCboTest()
Stop
End Function
The code below when run from function test() ON THE SAME MACHINE produces:
Using Acess97 (less than 1 second)
BOJ: 17/01/03 15:19:47 EOJ: 17/01/03 15:19:47
Using Access2000 (horrendous 20 seconds)
BOJ: 17/01/03 15:18:03 EOJ: 17/01/03 15:18:23
Both use Reference: Microsoft Office 9.0 Object Library
Access VBA code module fragment [this test simplifies actual application] :
Option Compare Database
Option Explicit
Public TestCommandBar As Office.commandBar
Private cboTest As Office.CommandBarComboBox
Public Function test()
Dim boj As Date, eoj As Date
Dim cbar As Office.commandBar
Set TestCommandBar = CommandBars.Add("BCStest", msoBarTop, , True)
Set cboTest = TestCommandBar.Controls.Add(msoControlDropdown)
With cboTest: .width = 150: .DropDownWidth = 200: .BeginGroup = True
.OnAction = "=pingCboTest()"
End With
boj = Now()
makeCboTest
TestCommandBar.Visible = True
eoj = Now()
Debug.Print "BOJ: " & boj & " EOJ: " & eoj
End Function
Public Function makeCboTest()
Dim ix As Integer
cboTest.Clear
For ix = 1 To 100
cboTest.AddItem "Entry" & ix ' THIS LINE TAKES ALL THE TIME
Next
cboTest.Enabled = True
End Function
Public Function pingCboTest()
Stop
End Function