U
Underpaidadmin
I have a custom search form that returns results in a subform. I don't know
if this is possible but how can I display just 1 record even if multiple
search results match it? Here is a snippet of the code that creates the
where statement and opens the subform filter:
Private Sub btnSearch_Click()
Dim strWhere As String
If Not IsNull(Me.txtCaseNum) Then
strWhere = strWhere & "tblCasesMain.CaseNum LIKE '*" & Me.txtCaseNum & "*'"
End If
'----------
If Not IsNull(Me.txtFirstName) Then
If Len(strWhere) > 6 Then
strWhere = strWhere & " AND "
End If
strWhere = strWhere & "tblNameslst.FirstName LIKE '*" & Me.txtFirstName & "*'"
End If
'----------
If Not IsNull(Me.curAmount) Then
If Len(strWhere) > 6 Then
strWhere = strWhere & " AND "
End If
strWhere = strWhere & "tblCasesMain.Exposure = " & Me.curAmount & " OR " &
"tblBalances.InitBal= " & Me.curAmount & " OR " &
"tblPaymentslst.PaymentAmount= " & Me.curAmount
Debug.Print strWhere
End If
If Not Me.FormFooter.Visible Then
Me.FormFooter.Visible = True
DoCmd.MoveSize Height:=Me.WindowHeight + Me.FormFooter.Height
End If
With Me.sbfBrowse.Form
.Filter = strWhere
.FilterOn = True
End With
End Sub
if this is possible but how can I display just 1 record even if multiple
search results match it? Here is a snippet of the code that creates the
where statement and opens the subform filter:
Private Sub btnSearch_Click()
Dim strWhere As String
If Not IsNull(Me.txtCaseNum) Then
strWhere = strWhere & "tblCasesMain.CaseNum LIKE '*" & Me.txtCaseNum & "*'"
End If
'----------
If Not IsNull(Me.txtFirstName) Then
If Len(strWhere) > 6 Then
strWhere = strWhere & " AND "
End If
strWhere = strWhere & "tblNameslst.FirstName LIKE '*" & Me.txtFirstName & "*'"
End If
'----------
If Not IsNull(Me.curAmount) Then
If Len(strWhere) > 6 Then
strWhere = strWhere & " AND "
End If
strWhere = strWhere & "tblCasesMain.Exposure = " & Me.curAmount & " OR " &
"tblBalances.InitBal= " & Me.curAmount & " OR " &
"tblPaymentslst.PaymentAmount= " & Me.curAmount
Debug.Print strWhere
End If
If Not Me.FormFooter.Visible Then
Me.FormFooter.Visible = True
DoCmd.MoveSize Height:=Me.WindowHeight + Me.FormFooter.Height
End If
With Me.sbfBrowse.Form
.Filter = strWhere
.FilterOn = True
End With
End Sub