属性设置!后来要查询的时候要写代码! If Check1.Value = vbChecked And Check2.Value = vbChecked Then strsql = "select sname as 姓名,account as 帐号,sclass as 班级 ,扣款日期 , 总额 as 扣款金额 from student" & Chr(32) End If If Check1.Value = vbChecked Then strsql = "select sname as 姓名,account as 帐号,sclass as 班级 ,扣款日期 , 总额 as 扣款金额 from student where 打印否='-1'" & Chr(32) End If If Check2.Value = vbChecked Then strsql = "select sname as 姓名,account as 帐号,sclass as 班级 ,扣款日期 , 总额 as 扣款金额 from student where 打印否='0'" & Chr(32) End If If Option1.Value = True Then strsql = strsql & "and account = " & Chr(34) & Trim(Text1.Text & " ") & Chr(34) End If If Option2.Value = True Then strsql = strsql & "and sname = " & Chr(34) & Trim(Text1.Text & " ") & Chr(34) End If If Option3.Value = True Then strsql = strsql & "and sclass = " & Chr(34) & Trim(Text1.Text & " ") & Chr(34) End If If Option4.Value = True Then strsql = strsql & "and 扣款日期 = " & Chr(34) & Trim(Text1.Text & " ") & Chr(34) End If Adodc1.RecordSource = strsql Adodc1.Refresh
If Check1.Value = vbChecked And Check2.Value = vbChecked Then strsql = "select sname as 姓名,account as 帐号,sclass as 班级 ,扣款日期 , 总额 as 扣款金额 from student" & Chr(32) End If 如果strsql是这个的话,后面就没有where了。Chr(32)还是加在Option后面好把你的语句在sql环境下测试一下。※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※ 天哪,这样写语句都有
好好检查一下。或者贴代码看看
If Check1.Value = vbChecked And Check2.Value = vbChecked Then
strsql = "select sname as 姓名,account as 帐号,sclass as 班级 ,扣款日期 , 总额 as 扣款金额 from student" & Chr(32)
End If
If Check1.Value = vbChecked Then
strsql = "select sname as 姓名,account as 帐号,sclass as 班级 ,扣款日期 , 总额 as 扣款金额 from student where 打印否='-1'" & Chr(32)
End If
If Check2.Value = vbChecked Then
strsql = "select sname as 姓名,account as 帐号,sclass as 班级 ,扣款日期 , 总额 as 扣款金额 from student where 打印否='0'" & Chr(32)
End If
If Option1.Value = True Then
strsql = strsql & "and account = " & Chr(34) & Trim(Text1.Text & " ") & Chr(34)
End If
If Option2.Value = True Then
strsql = strsql & "and sname = " & Chr(34) & Trim(Text1.Text & " ") & Chr(34)
End If
If Option3.Value = True Then
strsql = strsql & "and sclass = " & Chr(34) & Trim(Text1.Text & " ") & Chr(34)
End If
If Option4.Value = True Then
strsql = strsql & "and 扣款日期 = " & Chr(34) & Trim(Text1.Text & " ") & Chr(34)
End If
Adodc1.RecordSource = strsql
Adodc1.Refresh
好好检查一下。~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
我看了~是由于字段“扣款日期”~可是为什么数据库里有的!而且没有错误的!在sql语句里怎么就不对呢??
strsql = "select sname as 姓名,account as 帐号,sclass as 班级 ,扣款日期 , 总额 as 扣款金额 from student" & Chr(32)
End If
如果strsql是这个的话,后面就没有where了。Chr(32)还是加在Option后面好把你的语句在sql环境下测试一下。※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※
天哪,这样写语句都有
哎!烦死了!!