HI! I have succesfully used the code below to replaced quotation mark ( ' ) however, if i use the same code in my search textbox it gives me error. How do i let my search box accept quotation mark?VB Code:
Function doQuery(ByVal sCriteria As String, ByVal sfieldName As String) As String doQuery = "SELECT Code, ProductDescription, SellingPrice,PurchasePrice,Quantity, " & _ "Unit,EntryDate, ReOrder FROM tblStocks " & _ "WHERE " & sfieldName & " LIKE '" & sCriteria & "%'" End Function Private Sub txtSearch_Change() Dim rsStocks1 As New ADODB.Recordset sSQL = doQuery(txtSearch.Text, "ProductDescription") rsStocks1.Open sSQL, oConn, adOpenForwardOnly, adLockOptimistic If rsStocks1.EOF = False Then Call FillListView(lstStocks, rsStocks1) End If End Sub




Reply With Quote