I have an employee input form containing a "Find" combo box for user to search employee records in the embedded sub form. The VBA coding as follows:
Private Sub cboFind_AfterUpdate()
'Purpose: Find employee indicated in drop-down box
On Error GoTo Error_cboFind_AfterUpdate
Dim rst As Recordset
If IsNull(Me.cboFind) Then Exit Sub
Set rst = Me.fsubEmployeeInput.Form.RecordsetClone
With rst
.FindFirst "EmpID = " & gcstrQuote & Val(Me.cboFind) & gcstrQuote
If Not .NoMatch Then
Me.fsubEmployeeInput.Form.Bookmark = .Bookmark
End If
End With
Exit_cboFind_AfterUpdate:
Exit Sub
Error_cboFind_AfterUpdate:
MsgBox Err.Number & " - " & Err.Description
Resume Exit_cboFind_AfterUpdate
End Sub
(The EmpID is an indexed Primary Key)
This feature works fine until we put the backend of the database on a shared network drive. As the number of records increased in the database, it takes a long while to search employee from the cboFind box - worst case takes over a minute). I know that network traffic plays a important role since every search needs to query over 5000 records at the backend but wonder if there are any more effecient coding which may speed up the search process under this situation.
Thanks
Private Sub cboFind_AfterUpdate()
'Purpose: Find employee indicated in drop-down box
On Error GoTo Error_cboFind_AfterUpdate
Dim rst As Recordset
If IsNull(Me.cboFind) Then Exit Sub
Set rst = Me.fsubEmployeeInput.Form.RecordsetClone
With rst
.FindFirst "EmpID = " & gcstrQuote & Val(Me.cboFind) & gcstrQuote
If Not .NoMatch Then
Me.fsubEmployeeInput.Form.Bookmark = .Bookmark
End If
End With
Exit_cboFind_AfterUpdate:
Exit Sub
Error_cboFind_AfterUpdate:
MsgBox Err.Number & " - " & Err.Description
Resume Exit_cboFind_AfterUpdate
End Sub
(The EmpID is an indexed Primary Key)
This feature works fine until we put the backend of the database on a shared network drive. As the number of records increased in the database, it takes a long while to search employee from the cboFind box - worst case takes over a minute). I know that network traffic plays a important role since every search needs to query over 5000 records at the backend but wonder if there are any more effecient coding which may speed up the search process under this situation.
Thanks