I have a search feature on one of our sites that includes a standard text search. The search criteria are submitted and an SELECT statement is built to query the Access and/or SQL Server database.
The problem I have is that some of the database content contains spaces that shouldnt really be there. For example, one of our documents is called SC20 Sample Cooler and another similar document is called SC 20 Sample Cooler - additional notes. The space between SC and 20 on the 2nd document shouldnt be there so I would like the search facility to be able to remove the spaces from this field in the DB before it checks against the search criteria.
I have tried using the Replace() function as follows...
but get the following error...
The database is populated with thousands and thousands of documents, some of which are incorrectly named like this. Eventually we will get around to going through the DB one by one and fixing all the document names, but until then we would like to implement a 'work-around' using the Search facility.
Many thanks Tony
The problem I have is that some of the database content contains spaces that shouldnt really be there. For example, one of our documents is called SC20 Sample Cooler and another similar document is called SC 20 Sample Cooler - additional notes. The space between SC and 20 on the 2nd document shouldnt be there so I would like the search facility to be able to remove the spaces from this field in the DB before it checks against the search criteria.
I have tried using the Replace() function as follows...
Code:
strSearchSQL="SELECT * FROM tblName WHERE Replace(title,' ','') LIKE '%" & strSearchCriteria & "%';"
Code:
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Undefined function 'Replace' in expression.
The database is populated with thousands and thousands of documents, some of which are incorrectly named like this. Eventually we will get around to going through the DB one by one and fixing all the document names, but until then we would like to implement a 'work-around' using the Search facility.
Many thanks Tony
