And how can I use it with my following code so that if an option is selected which requires all the words entered in a text box to be joined by and or search it as a phrase or search tem by joining with or. All the options is in the combobox?
Thanks
VB Code:
Private Sub cmdSearch1_Click() Dim sTarget As String Dim wordcount As Integer Dim i As Integer moRS.MoveFirst sTarget = Replace$(txtSearch1.Text, "*", "%") sTarget = Replace$(sTarget, "'", "''") Dim sqlsearch() As String sqlsearch = Split(sTarget, Chr(32), 1) wordcount = UBound(sqlsearch) + 1 'Decide on right SQL statement If optKeyword.Value = True Then moRS.Find "Keywords like '" & sqlsearch & "'" ElseIf optTitle.Value = True Then moRS.Find "Article_Name like '" & sqlsearch & "'" ElseIf optAuthor.Value = True Then moRS.Find "Author like '" & sqlsearch & "'" ElseIf optJournaltitle.Value = True Then moRS.Find "Journal_Name like '" & sqlsearch & "'" End If If moRS.EOF Then MsgBox "no match found", vbOKOnly, "sorry" Else MsgBox "found " & moRS.Fields("Journal_Name").Value End If End Sub




Reply With Quote