running the list box query after open the form

kowol

Registered User.
Local time
Today, 03:53
Joined
Apr 23, 2012
Messages
16
I have the form which takes too long to open due to the list box in the form
The list box shows the result based on the text box input.
Is there a way to run the list box query after opening the form so that I can open the form quicker?

Thanks
 
Leave the Listbox Rowsource blank and provide it after the Text box has been populated, something like;

Private Sub Textbox_AfterUpdate()
Dim strSQL as String
StrSQL = "SELECT [FieldX],[FieldY],[FieldZ] FROM tableA WHERE [Field]='" & Textbox & "';"
Listbox.RowSource = strSQL
End Sub
 

Users who are viewing this thread

Back
Top Bottom