I have a form where the user searches an access DB, the user will use this all day. Doing new searches all the time.
VB Code:
Private Sub cmdStart_Click() 'Free Memory Set txtContactID.DataSource = Nothing Set txtFirstName.DataSource = Nothing Set txtLastName.DataSource = Nothing Set txtHomePhone.DataSource = Nothing Set txtWorkPhone.DataSource = Nothing If rsContacts.State = 1 Then rsContacts.Move 0 rsContacts.Close End If Set rsContacts = Nothing 'Open new data Set rsContacts = New ADODB.Recordset rsContacts.Open "SELECT * FROM Contacts WHERE LastName = '" & txtSearch.Text & "'", dbContacts, adOpenStatic, adLockOptimistic, adCmdText Set txtContactID.DataSource = rsContacts Set txtFirstName.DataSource = rsContacts Set txtLastName.DataSource = rsContacts Set txtHomePhone.DataSource = rsContacts Set txtWorkPhone.DataSource = rsContacts End Sub
It works fine... Almost..
After using it for several hours it becomes really slow. If you restart the app, it speeds back up again.
I modified it to run 100 searches in a row and time each search. Indeed it does get slower and slower and slower.
Above is the ONLY code executed between searches. I cannot figure out how to fix this. I know I could just set the text of the textboxes instead of binding them to the recordset, but I'd really prefer not to do that..
Any help would be awesome!


Reply With Quote