以下就是有问题的源程序:
Command17.Enabled = False
Dim sql1 As String
Dim aa As String
Dim sql As String
sql1 = frmLogin.odbc
Data1.Connect = sql1
DoEvents
aa = LTrim(RTrim(Text1(0).Text))
For i = 1 To Len(aa)
If Right(Left(aa, i), 1) = "a" Then
i = i + 2
laa = Left(aa, i)
lbb = Right(aa, Len(aa) - i)
aa = laa + " 文档号 " + lbb
End If
If Right(Left(aa, i), 1) = "o" Then
i = i + 1
laa = Left(aa, i)
lbb = Right(aa, Len(aa) - i)
aa = laa + " 文档号 " + lbb
End If
Next i
If aa = "" Then
t1 = " 文档号>=0"
Else
If Left(aa, 1) = "<" Or Left(aa, 1) = ">" Or Left(aa, 1) = "=" Then
t1 = " 文档号" + aa
Else
t1 = " 文档号=" + aa
End If
End If
t2 = " and 合同号 like " + "'" + "&" & RTrim(Text1(1).Text) & "&" + "'"
t3 = " and 合同文件名 like " + "'" + "&" & RTrim(Text1(2).Text) & "&" + "'"
t4 = " and 甲方 like " + "'" + "&" & RTrim(Text1(3).Text) & "&" + "'"
t5 = " and 乙方 like " + "'" + "&" & RTrim(Text1(4).Text) & "&" + "'"
t6 = " and 经办人 like " + "'" + "&" & RTrim(Text1(5).Text) & "&" + "'"
t7 = " and 乙方电话 like " + "'" + "&" & RTrim(Text1(6).Text) & "&" + "'"
aa = LTrim(RTrim(Text1(7).Text))
For i = 1 To Len(aa)
If Right(Left(aa, i), 1) = "a" Then
i = i + 2
laa = Left(aa, i)
lbb = Right(aa, Len(aa) - i)
aa = laa + " 签约时间 " + lbb
End If
If Right(Left(aa, i), 1) = "o" Then
i = i + 1
laa = Left(aa, i)
lbb = Right(aa, Len(aa) - i)
aa = laa + " 签约时间 " + lbb
End If
Next i
If aa = "" Then
t8 = " and 签约时间>=0"
Else
If Left(aa, 1) = "<" Or Left(aa, 1) = ">" Or Left(aa, 1) = "=" Then
t8 = " and 签约时间" + aa
Else
t8 = " and 签约时间=" + aa
End If
End If
aa = LTrim(RTrim(Text1(8).Text))
For i = 1 To Len(aa)
If Right(Left(aa, i), 1) = "a" Then
i = i + 2
laa = Left(aa, i)
lbb = Right(aa, Len(aa) - i)
aa = laa + " 共计金额 " + lbb
End If
If Right(Left(aa, i), 1) = "o" Then
i = i + 1
laa = Left(aa, i)
lbb = Right(aa, Len(aa) - i)
aa = laa + " 共计金额 " + lbb
End If
Next i
If aa = "" Then
t9 = " and 共计金额>=0"
Else
If Left(aa, 1) = "<" Or Left(aa, 1) = ">" Or Left(aa, 1) = "=" Then
t9 = " and 共计金额" + aa
Else
t9 = " and 共计金额=" + aa
End If
End If
t10 = " and 部门 like " + "'" + "&" & RTrim(Text1(9).Text) & "&" + "'"
t11 = " and 影片名称 like " + "'" + "&" & RTrim(Text1(10).Text) & "&" + "'"
t12 = " and 关键字 like " + "'" + "&" & RTrim(Text1(11).Text) & "&" + "'"
t13 = " and 存储编号 like " + "'" + "&" & RTrim(Text1(12).Text) & "&" + "'"