Hi,
I am building a SQL query on the fly - part of the code is as follows:
AuthorSearch=""
If UBOUND(AuthorArray,1) >= 0 Then AuthorSearch=AuthorSearch & "("
For i=0 To UBOUND(AuthorArray,1)
If ExactMatch=TRUE Then AuthorSearch=AuthorSearch & "' ' " & CHR(038)
AuthorSearch=AuthorSearch & " Replace(Catalogue.Author, ',', ' ') "
If ExactMatch=TRUE Then AuthorSearch=AuthorSearch & CHR(038) & " ' ' "
AuthorSearch=AuthorSearch & "LIKE "
AuthorSearch=AuthorSearch & " '%"
If ExactMatch=TRUE Then AuthorSearch=AuthorSearch & " "
AuthorSearch=AuthorSearch & AuthorArray(i)
If ExactMatch=TRUE Then AuthorSearch=AuthorSearch & " "
AuthorSearch=AuthorSearch & "%' "
If i<UBOUND(AuthorArray,1) Then
AuthorSearch=AuthorSearch & MatchType
End If
Next
If UBOUND(AuthorArray,1) >= 0 Then AuthorSearch=AuthorSearch & ")"
The final SQL query which I display with Response.Write is as follows:
SELECT Catalogue.BookID, Catalogue.Author, Catalogue.Title, Catalogue.Edition, Catalogue.PublicationYear, Catalogue.Publisher, Catalogue.Notes, Catalogue.ClassMarks, Catalogue.Department, Catalogue.ISBN FROM Catalogue WHERE (' ' & Replace(Catalogue.Author, ',', ' ') & ' ' LIKE '% abbey %' )
I execute the code with the following - TBL is my recordset object and DB is my connection object.
set TBL = DB.Execute(strSQL)
If I copy and paste what is displayed with response.write in to my access database as a query it works but when I try to execute the query on the script it comes up with
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Undefined function 'Replace' in expression.
Any ideas?
Thanks very much
Ed
I am building a SQL query on the fly - part of the code is as follows:
AuthorSearch=""
If UBOUND(AuthorArray,1) >= 0 Then AuthorSearch=AuthorSearch & "("
For i=0 To UBOUND(AuthorArray,1)
If ExactMatch=TRUE Then AuthorSearch=AuthorSearch & "' ' " & CHR(038)
AuthorSearch=AuthorSearch & " Replace(Catalogue.Author, ',', ' ') "
If ExactMatch=TRUE Then AuthorSearch=AuthorSearch & CHR(038) & " ' ' "
AuthorSearch=AuthorSearch & "LIKE "
AuthorSearch=AuthorSearch & " '%"
If ExactMatch=TRUE Then AuthorSearch=AuthorSearch & " "
AuthorSearch=AuthorSearch & AuthorArray(i)
If ExactMatch=TRUE Then AuthorSearch=AuthorSearch & " "
AuthorSearch=AuthorSearch & "%' "
If i<UBOUND(AuthorArray,1) Then
AuthorSearch=AuthorSearch & MatchType
End If
Next
If UBOUND(AuthorArray,1) >= 0 Then AuthorSearch=AuthorSearch & ")"
The final SQL query which I display with Response.Write is as follows:
SELECT Catalogue.BookID, Catalogue.Author, Catalogue.Title, Catalogue.Edition, Catalogue.PublicationYear, Catalogue.Publisher, Catalogue.Notes, Catalogue.ClassMarks, Catalogue.Department, Catalogue.ISBN FROM Catalogue WHERE (' ' & Replace(Catalogue.Author, ',', ' ') & ' ' LIKE '% abbey %' )
I execute the code with the following - TBL is my recordset object and DB is my connection object.
set TBL = DB.Execute(strSQL)
If I copy and paste what is displayed with response.write in to my access database as a query it works but when I try to execute the query on the script it comes up with
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Undefined function 'Replace' in expression.
Any ideas?
Thanks very much
Ed