S
Steve7
Guest
I am new to Access and VB and am trying to do a partial text search using a combo box and a text box. This is working OK but i cann't seem to get a Message NO RECORDS FOUND when there is no match it just brings up a blank form. Have tried to do the things that have already been suggested to other users but I cannt seem to get them to work.
Any help would be appreciated.
This is the code that I am using for the search.
Private Sub btnSearch_Click()
Dim strSQL As String
Dim strCombo As String
Dim strText As String
Me.cmbSource.SetFocus
strCombo = Me.cmbSource.Value
Me.txtSearch.SetFocus
strText = Me.txtSearch.Text
strSQL = "[" & strCombo & "] like ""*" & strText & "*"""
DoCmd.OpenForm "frmEquipmentSearch", acNormal, , strSQL
End Sub
Any help would be appreciated.
This is the code that I am using for the search.
Private Sub btnSearch_Click()
Dim strSQL As String
Dim strCombo As String
Dim strText As String
Me.cmbSource.SetFocus
strCombo = Me.cmbSource.Value
Me.txtSearch.SetFocus
strText = Me.txtSearch.Text
strSQL = "[" & strCombo & "] like ""*" & strText & "*"""
DoCmd.OpenForm "frmEquipmentSearch", acNormal, , strSQL
End Sub