Hey there, I had a form in access 2007. I had recently upgraded it from 97 where it ran within seconds. Now when I run it it takes something like 20-30 seconds. I pinpointed one of the areas where code was running really slow.
There's a number of controls on the form, but that isn't the issue from what I can tell. Actually looping through each of the controls is a very quick task. However, every combo box and text control has a control source property set. And there's 32 of them. When the code that sets the controlsource to "" gets run it takes about a second or two. You do the math.
Is there any way for me to speed up this task? They each have a different control source.
Code:
'Unbinds all text and combo boxes from the work form
Sub clearform()
Dim o As Object
Open MyFile For Output As fnum
For Each o In Me.Form
If Left(o.Name, 4) = "Text" Then o.ControlSource = ""
If Left(o.Name, 5) = "Combo" Then o.ControlSource = "" Next o
End Sub
There's a number of controls on the form, but that isn't the issue from what I can tell. Actually looping through each of the controls is a very quick task. However, every combo box and text control has a control source property set. And there's 32 of them. When the code that sets the controlsource to "" gets run it takes about a second or two. You do the math.
Is there any way for me to speed up this task? They each have a different control source.