Please help me in solving this error of my project.
This error appear when i enter this character [
it shows me that i enter an invalid string.
where particularly is the error? does it concern with the keyascci?
thanks for ur help.
Private Sub txtsearchbook_Change()
If cmbsearchbook.Text <> "" Then
adobooksearch.RecordSource = "SELECT * from tblbooks where " & cmbsearchbook & " like '%" & Replace(txtsearchbook.Text, "'", "''") & "%'"
adobooksearch.RecordSource = "SELECT * from tblbooks" 'where Author like '%" & "#" & "%'"
Private Sub txtsearchbook_GotFocus()
DataList2.ListField = cmbsearchbook
If cmbsearchbook = "" Then
MESS = MsgBox("select category first", vbInformation + vbOKOnly, "search")
If MESS = vbOK Then
txtsearchbook = ""
DataList2.Visible = True
If txtsearchbook <> "" Then
txtsearchbook.SelStart = 0
txtsearchbook.SelLength = Len(txtsearchbook.Text)
Private Sub txtsearchbook_KeyPress(KeyAscii As Integer)
If KeyAscii = 123 Or KeyAscii = 125 Then
MsgBox "Invalid Character"
I can't see where you open or close your database. So I suggest you check your select statement and check that your database is open etc. On second thoughts you might want to validate the string that comes from the textbox.