Here is the complete query of the error.
I have a combobox, a txtbox namely txtsearch and a datalistfield in which all the titles of the book will appear.
Private Sub txtsearchbook_Change()
If cmbsearchbook.Text <> "" Then
adobooksearch.RecordSource = "SELECT * from tblbooks where " & cmbsearchbook & " like '%" & txtsearchbook.Text & "%'"
adobooksearch.RecordSource = "SELECT * from tblbooks" 'where Author like '%" & "#" & "%'"
It looks like your WHERE criteria contains a value with an apostraphe so your SQL statement is breaking as the criteria itself needs to be enclosed within apostraphes.
You can either use parameterised queries or escape your search criteria. For example "SELECT * from tblbooks where " & cmbsearchbook & " like '%" & Replace(txtsearchbook.Text, "'", "''") & "%'". Note how the replace function has been used to take one apostraphe and replace it with two, thus escaping it.