Public Function cc (SQL) Index, the As Boolean
If Rsbdata. State=adStateOpen Then
Rsbdata. Close
End the If
On Error GoTo ErrMsg
Dim strSQL As String
StrSQL="select * from kcm01"
If Text9="" Then 'number
MsgBox "please enter the brand code!"
The Else
StrSQL=strSQL & amp; "Where KCCKDM like" & amp; "' % & amp;" Text9 & amp; "% '
"End the If
Rsbdata. CursorLocation=adUseClient
Rsbdata. Open strSQL, Consb
Cc=True
The Exit Function
ErrMsg:
MsgBox "statement execution failed! StrSQL, 16
"Cc=False
End the Function
CodePudding user response:
Suggest to manually perform related SQL statements in the query analyzer, determine and correct after transplanted into the code,CodePudding user response:
Put the Debug out strSQL values, in the database to check and see what's wrong,CodePudding user response:
StrSQL="select * from kcm01 where KCCKDM like '%" & amp; Text9. Text & amp; "% '"
CodePudding user response:
1, check whether Consb normal2, check whether strSQL right
3, set Rsbdata=https://bbs.csdn.net/topics/Consb.execute (strSQL)
4, in SQL like low efficiency especially like this' % % aaaaa
'.
CodePudding user response:
StrSQL=strSQL & amp; "Where KCCKDM like" & amp; "' % & amp;" Text9 & amp; "% '"Is amended as:
StrSQL=strSQL & amp; "Where KCCKDM Like '%" & amp; Text9. Text & amp; "% '"