This is part of a tech support call log that I’m implementing as a sort of post production quality control log.
I appreciate any help you can give me
Re: ApplyFilter methodology
--------------------------------------------------------------------------------
On your form (Form Header section?), place 3 text boxes where the user can
enter values to filter on, and a pair of command buttons to apply and remove
the filter.
This example shows how to set the filter based on any combination of entries
from the 3 boxes:
Expand|Select|Wrap|Line Numbers
- Private Sub cmdApplyFilter_Click
- Dim strWhere As String
- Dim lngLen As Long
- If Me.Dirty Then 'Save first.
- Me.Dirty = False
- End If
- 'Look at the text boxes where the user entered something.
- If Not IsNull(txtFindStatusType) Then
- strWhere = strWhere & "([Status Type] = " & _
- Me.txtFindStatusType & ") AND "
- End If
- If Not IsNull(txtFindDept) Then
- strWhere = strWhere & "([Department Number] = " & _
- Me.txtFindDept & ") AND "
- End If
- If Not IsNull(txtFindVendor) Then
- strWhere = strWhere & "([Vendor Name] = """ & _
- Me.txtFindVendor & """) AND "
- End If
- 'Remove the trailing " AND ", and see what's left.
- lngLen = Len(strWhere) - 5
- If lngLen <= 0 Then
- MsgBox "No criteria"
- Else
- Me.Filter = Left(strWhere, lngLen)
- Me.FilterOn = True
- End If
- End Sub