请教大家问题,谢谢啦
Private Sub Command1_Click()Dim aa As Integer
txtsql = ""
If Trim(Text1(0).Text) <> "" Then
aa = 1
If txtsql = "" Then 这边的txtsql是什么作用,有定义全局变量,帮忙看看
txtsql = "xj.学号='" & Trim(Text1(0).Text) & "'"
Else
txtsql = txtsql & "and xj.学号='" & Trim(Text1(0).Text) & "'"
End If
End If
If Trim(Text1(1).Text) <> "" Then
aa = 1 这边的aa是什么作用,也帮忙看看
If txtsql = "" Then
txtsql = "xj.姓名='" & Trim(Text1(1).Text) & "'"
Else
txtsql = txtsql & "and xj.姓名='" & Trim(Text1(1).Text) & "'"
End If
End If
If Trim(Text1(2).Text) <> "" Then
aa = 1
If txtsql = "" Then
txtsql = "xj.班级='" & Trim(Text1(2).Text) & "'"
Else
txtsql = txtsql & "and xj.班级='" & Trim(Text1(2).Text) & "'"
End If
End If
If Trim(Text1(3).Text) <> "" Then
aa = 1
txtsql = ""
txtsql = "xj.姓名 like '%" & Trim(Text1(3).Text) & "%'"
End If
If aa = 0 Then
ss = MsgBox("你至少要输入一个条件以上才能查询!", , " 警告")
Text1(0).SetFocus
Exit Sub
End If