If Checkpinzhong. Value=https://bbs.csdn.net/topics/1 Then
If strQuery="" Then
StrQuery="pinzhong like '% %'" + txtpinzhong. Text + ", "
The Else
StrQuery=strQuery & amp; "And pinzhong like '% %'" + txtpinzhong. Text + ", "
End the If
End the If
If Checkfengchan. Value=https://bbs.csdn.net/topics/1 Then
If strQuery="" Then
StrQuery="fengchanxing like '% %'" + txtfengchan. Text + ", "
The Else
StrQuery=strQuery & amp; "And fengchanxing like '% %'" + txtfengchan. Text + ", "
End the If
End the If
Adodc1. RecordSource="select * from Taoziyuan where" & amp; StrQuery
Adodc1. Refresh
Exit Sub
CodePudding user response:
Repeated questionsCodePudding user response:
Dim strPinZhong as stringDim strFengChan as string
If Checkpinzhong. Value=https://bbs.csdn.net/topics/1 Then
StrPingZhong="and pinzhong like '% %'" + txtpinzhong. Text + ", "
The Else
StrPingZhong=""
End the If
If Checkfengchan. Value=https://bbs.csdn.net/topics/1 Then
StrFengChan="and fengchanxing like '% %'" + txtfengchan. Text + ", "
The Else
StrFengChan=""
End the If
Adodc1. RecordSource="select * from Taoziyuan where 1"=1 "& amp; StrPingZhong & amp; strFengChan