Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can i improve the performance of comboboxes,listboxes and subforms ?

Troubleshooting

How can i improve the performance of comboboxes,listboxes and subforms ?

by  Chance1234  Posted    (Edited  )
take out the rowsource values of these controls and place the SQL in the tag property of the control.

then on your form_load event add the following

Private Sub Form_Load()


Dim ctrl As Control


For Each ctrl In Me.Controls
Select Case ctrl.Properties("ControlType")
Case acComboBox, acListBox
ctrl.RowSource = ctrl.Tag
Case acSubform
ctrl.Form.RecordSource = ctrl.Form.Tag
Case Else
'do nothing
End Select
Next ctl

Set ctl = Nothing

End Sub


You can also add in to the unload event, the same code above with the rowsource value set to ""

you will notice a dramatic improvement with speed with the above
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top