Combo Box Requery

  • Thread starter Thread starter XMan
  • Start date Start date
X

XMan

Do all combo box requery (hitting the DB) on every main record? I have a
form that has about 20 combo boxes (look-up tables). This form is slow and I
would like to speed it up. All suggestions are welcome. TIA.
 
Hi,

The lists are built when the form is loaded (or opened) and when you
requery the combo box, either explicitly, either when you modify its
rowsource.

If possible, rather than modifying the rowsource on the AfterUpdate
events of other controls, do it like in the GotFocus event of the combo box:

Dim str as String
' build the string, which is assumed dependant of some
' values of some controls in the form,
' just for illustration, something like:
str= "SELECT ... FROM ... WHERE f1=" & Me.ControlForF1

' compare what is wanted to what is actually in the list
If Me.RowSource = str then
' same, so, do nothing
Else ' update the list
Me.RowSource=str ' implicit requery
End If



Doing so, the list would be requeried only moment before it may be displayed
(dropped down) by the end user...otherwise, why spending time to requery a
HIDDEN list ? so, as long as it is hidden, why updating it, uselessly, but
not execution time-free.



Hoping it may help,
Vanderghast, Access MVP
 
Back
Top