G
Guest
I have a search form that the user cann search based on one of three things:
FPI
Coordinator
SR
With a search button that opens the field. Below is the code I am using:
Private Sub cmdSearchFPI_Click()
Dim strSQL As String
Dim strWhere As String
strForm = "main"
If Not IsNull(txtFPI) Then
strWhere = strWhere & " AND [fpi]= " & "'" & txtFPI & "'"
End If
If Not IsNull(txtSR) Then
strWhere = strWhere & " AND [sr] = " & "'" & txtSR & "'"
End If
If Not IsNull(txtCoordinator) Then
strWhere = strWhere & " AND [coordinator] = " & "'" & txtCoordinator
& "'"
End If
If Not IsNull(strWhere) Then
strSQL = Mid$(strWhere, 6)
End If
'open report based on the contents of strSQL
DoCmd.OpenForm strForm, acNormal, , strSQL
End Sub
I was wondering if/where you can specify so that it will open using any part
of field? For example currently, if you put user1 in coordinator field and
push the search button it will not find it because it wants the exact name of
user111.
Any help would be appreciated.
Thanks
FPI
Coordinator
SR
With a search button that opens the field. Below is the code I am using:
Private Sub cmdSearchFPI_Click()
Dim strSQL As String
Dim strWhere As String
strForm = "main"
If Not IsNull(txtFPI) Then
strWhere = strWhere & " AND [fpi]= " & "'" & txtFPI & "'"
End If
If Not IsNull(txtSR) Then
strWhere = strWhere & " AND [sr] = " & "'" & txtSR & "'"
End If
If Not IsNull(txtCoordinator) Then
strWhere = strWhere & " AND [coordinator] = " & "'" & txtCoordinator
& "'"
End If
If Not IsNull(strWhere) Then
strSQL = Mid$(strWhere, 6)
End If
'open report based on the contents of strSQL
DoCmd.OpenForm strForm, acNormal, , strSQL
End Sub
I was wondering if/where you can specify so that it will open using any part
of field? For example currently, if you put user1 in coordinator field and
push the search button it will not find it because it wants the exact name of
user111.
Any help would be appreciated.
Thanks