DatabaseTash
Registered User.
- Local time
- Today, 14:26
- Joined
- Jul 23, 2018
- Messages
- 149
I have a search form which is performing searches extremely slow! (See screen shot of form attached) I have recently rebuilt the form and changed to a subform to help with locking data from certain users. This new form is searching, just really slowly!!
The Parish Search on this form works quickly, but the the Partial Plan Number Search takes for ever. The Partial plan number search does return a result, it takes too long though. Why would 2 searches on the same form behave so differently? In the table where the data is kept, the fields that are being searched both have the Data Type set to short text. I have tried to index the Plan Number field, but it didn't make any difference.
The code below worked really well before I changed over to the subform layout. I need to keep it as a subform now though to resolve the data locking issues I was having previously.
This is the code that is on each of the search buttons:
Any ideas what else I could try??
The Parish Search on this form works quickly, but the the Partial Plan Number Search takes for ever. The Partial plan number search does return a result, it takes too long though. Why would 2 searches on the same form behave so differently? In the table where the data is kept, the fields that are being searched both have the Data Type set to short text. I have tried to index the Plan Number field, but it didn't make any difference.
The code below worked really well before I changed over to the subform layout. I need to keep it as a subform now though to resolve the data locking issues I was having previously.
This is the code that is on each of the search buttons:
Code:
'PARISH SEARCH
Private Sub Command96_Click()
Dim strSearch As String
Dim strText As String
strText = Me.txtSearch.Value
Form!frmSubCombinedParishSearch.Form.RecordSource = "SELECT * from tblCadastralPlansRegister where (Parish like ""*" & strText & "*"")"
Me.RecordSource = strSearch
End Sub
'PLAN NUMBER SEARCH
Private Sub Command122_Click()
Dim strSearch As String
Dim strText As String
strText = Me.txtPlanNumber.Value
Form!frmSubCombinedParishSearch.Form.RecordSource = "SELECT * from tblCadastralPlansRegister where ([Plan Number] like ""*" & strText & "*"")"
Me.RecordSource = strSearch
End Sub
Any ideas what else I could try??