John Big Booty
AWF VIP
- Local time
- Tomorrow, 05:19
- Joined
- Aug 29, 2005
- Messages
- 8,262
Perhaps the discussion and sample I posted here, will give you some further inspiration.
Private Sub btnSearch_Click()
Dim strFilter As String
Me.Refresh
Dim strCombo As String
strCombo = Me.cmbGoto
If strCombo = "Title" Then
strFilter = "[Title] like '*" & Me.txtGoTo & "* '"
Forms!LibCatalogue.Form.Filter = strFilter
[COLOR=green]'your code said to put Forms!FormName!SubFormName.Form.Filter, but i [/COLOR]
[COLOR=green]'dont have a subform, just a continuous form, which I dont think has a s[/COLOR]
[COLOR=green]'separate name, does it?[/COLOR]
Forms!LibCatalogue.Form.FilterOn = True
Me.txtGoTo.SetFocus
[COLOR=green]'right, this wasnt in your code but I kept getting an error of "cannot [/COLOR]
[COLOR=green]'reference a control unless it has focus[/COLOR]
Me.txtGoTo.SelStart = Len(Me.txtGoTo)
Else
[COLOR=green]'ok, from here on i have a bunch of if-else statements according to what the user choice in the combo box[/COLOR]
If strCombo = "Author or Source" Then
strFilter = "[AuthorSource] like '*" & Me.txtGoTo & "* '"
Forms!LibCatalogue.Form.Filter = strFilter
Forms!LibCatalogue.Form.FilterOn = True
Me.txtGoTo.SetFocus
Me.txtGoTo.SelStart = Len(Me.txtGoTo)
Else
If strCombo = "Publishers" Then
strFilter = "[Publishers] like '*" & Me.txtGoTo & "* '"
Forms!LibCatalogue.Form.Filter = strFilter
Forms!LibCatalogue.Form.FilterOn = True
Me.txtGoTo.SetFocus
Me.txtGoTo.SelStart = Len(Me.txtGoTo)
Else
If strCombo = "Date Published" Then
strFilter = "[Publishers] like '*" & Me.txtGoTo & "* '"
Forms!LibCatalogue.Form.Filter = strFilter
Forms!LibCatalogue.Form.FilterOn = True
Me.txtGoTo.SetFocus
Me.txtGoTo.SelStart = Len(Me.txtGoTo)
Else
If strCombo = "Publication Type" Then
strFilter = "[PublicationType] like '*" & Me.txtGoTo & "* '"
Forms!LibCatalogue.Form.Filter = strFilter
Forms!LibCatalogue.Form.FilterOn = True
Me.txtGoTo.SetFocus
Me.txtGoTo.SelStart = Len(Me.txtGoTo)
Else
End If
End If
End If
End If
End If
End Sub
Because of the performance issues I found re-querying on a split database setup (with the back end on a network server, front end on a local computer), I found that populating a local temporary table with the search criteria from the BE database improved performance [/QUOTE]
Creating and dropping temp tables in the front end will cause bloat and greatly contribute to the potential for corruption.
Temp tables should never be written into either the backend or the front end but to a separate local database. This database can be deleted and recreated as required.
'Disable Warning that data in "temp table" will be deleted and
'repopulated via a query with current data
Application.SetOption "Confirm Action Queries", 0
Application.SetOption "Confirm Document Deletions", 0
Application.SetOption "Confirm Record Changes", 0
That's a really useful way to search, but it seems to suffer significant performance issues on a split database over a network with it requerying the database after every change of character to update the list.
Me.Filter = strFilter
strFilter = "[Title] like '*" & Me.txtGoTo & "*'"