以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 筛选数据时弹出错误提示 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=147303) |
-- 作者:裴保民 -- 发布时间:2020/3/13 15:43:00 -- 筛选数据时弹出错误提示 If .value IsNot Nothing AndAlso .value="所有转账" Then If zzmc.value IsNot Nothing AndAlso zzmc .value="所有账户" Then If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & " 转出账户 ="\'" Filter = Filter & " And 转入账户 ="\'" Else If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & "转出账户= \'" & .Value & "\'" Filter = Filter & " And 转入账户= \'" & .Value & "\'" End If ElseIf .value="转出账目" Then If zzmc.value IsNot Nothing AndAlso zzmc .value="所有账户" Then If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & "转出账户= "\'" Else If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & "转出账户= \'" & .Value & "\'" End If End If 这段代码哪有为题呢?运行后怎么老缺少参数呢?
[此贴子已经被作者于2020/3/13 21:45:15编辑过]
|
-- 作者:有点蓝 -- 发布时间:2020/3/13 15:47:00 -- 调试一下,看看条件十分正确 If .value IsNot Nothing AndAlso .value="所有转账" Then If zzmc.value IsNot Nothing AndAlso zzmc .value="所有账户" Then If Filter > "" Then Filter = Filter & " And " End If msgbox(Filter ) Filter = Filter & " 转出账户 ="\'" msgbox(Filter ) Filter = Filter & " And 转入账户 ="\'" msgbox(Filter ) Else If Filter > "" Then Filter = Filter & " And " End If msgbox(Filter ) Filter = Filter & "转出账户= \'" & .Value & "\'" msgbox(Filter ) Filter = Filter & " And 转入账户= \'" & .Value & "\'" msgbox(Filter ) End If |
-- 作者:裴保民 -- 发布时间:2020/3/13 16:03:00 -- 假如“转出账户”和“转出账户”都为空值的时候 Filter = Filter & " 转出账户 Is null\'" Filter = Filter & "Or 转入账户 Is null\'" 代码对吗? 怎么老弹出缺少参数呢? [此贴子已经被作者于2020/3/13 16:08:57编辑过]
|
-- 作者:有点蓝 -- 发布时间:2020/3/13 16:27:00 -- 多余的单引号都看不到么 |
-- 作者:裴保民 -- 发布时间:2020/3/13 17:11:00 -- 去了还是错误呢? Filter = Filter & " 转出账户 Is null" Filter = Filter & "Or 转入账户 Is null" msgbox(Filter ) [此贴子已经被作者于2020/3/13 17:11:47编辑过]
|
-- 作者:有点蓝 -- 发布时间:2020/3/13 17:18:00 -- 关键字前后加空格啊,不然就粘成一个词了 |
-- 作者:裴保民 -- 发布时间:2020/3/13 17:52:00 -- 筛选出 转出账户为全部数据怎么写呀?怎么老错呢? Filter = Filter & " 转出账户 ="\'" |
-- 作者:有点蓝 -- 发布时间:2020/3/13 20:04:00 -- |
-- 作者:裴保民 -- 发布时间:2020/3/13 20:28:00 -- Dim cxfs As WinForm.RadioButton Dim Filter As String Select Case cxfs Case cxfs =e.Form.Controls("mxRadioButton").Checked If qssj.Value IsNot Nothing AndAlso zzsj.Value IsNot Nothing Then If Filter > "" Then
Filter = Filter
& " And
" End If Filter = Filter & "转账日期>= #"
& StartDate
& "#
And 转账日期 <= #"
& EndDate
& "# " End If With zzlx If .value IsNot Nothing AndAlso .value="所有转账" Then If zzmc.value IsNot Nothing AndAlso zzmc.value="所有账户" Then
If Filter
> "" Then
Filter = Filter
& " And
"
End If
Filter = Filter
& " 转出账户=\'""
Filter = Filter
& " Or 转入账户="\'" Else
If Filter
> "" Then
Filter = Filter
& " And
"
End If
Filter = Filter
& "转出账户= \'"
& zzmc.Value & "\'"
Filter = Filter
& "or 转入账户= \'"
& zzmc.Value & "\'" End If ElseIf .value="转出账目" Then If zzmc.value IsNot Nothing AndAlso zzmc .value="所有账户" Then
If Filter
> "" Then
Filter = Filter
& " And
"
End If Else
If Filter
> "" Then
Filter = Filter
& " And
"
End If
Filter = Filter
& "转出账户= \'"
& zzmc.Value & "\'" End If ElseIf .value="转入账目" Then If zzmc.value IsNot Nothing AndAlso zzmc .value="所有账户" Then
If Filter
> "" Then
Filter = Filter
& " And
"
End If Else
If Filter
> "" Then
Filter = Filter
& " And
"
End If
Filter = Filter
& "转入账户= \'"
& zzmc.Value & "\'" End If End If
End With |
-- 作者:有点蓝 -- 发布时间:2020/3/13 20:30:00 -- 全部数据还有必要添加条件吗?去掉 |