Foxtable(狐表)用户栏目专家坐堂 → [求助]查询


  共有1956人关注过本帖树形打印复制链接

主题:[求助]查询

帅哥哟,离线,有人找我吗?
1131369760
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:婴狐 帖子:15 积分:170 威望:0 精华:0 注册:2017/6/22 20:51:00
[求助]查询  发帖心情 Post By:2017/6/23 20:09:00 [只看该作者]

请问错在哪里。

这是错误提示(无法将类型为“Foxtable.WinForm.RadioButton”的对象强制转换为类型“Foxtable.WinForm.ComboBox”。

这是查询代码Dim cmb1 As WinForm.ComboBox = e.Form.Controls("radweixian")
Dim cmb2 As WinForm.ComboBox = e.Form.Controls("raddanwei")
If e.Form.Controls("radweixian").Checked = True
    Dim Filter As String = ""
    With e.Form.Controls("radweixian")
        If .Value IsNot Nothing Then
            Filter = "危险级别= '" & .Value & "'"
        End If
    End With
    With e.Form.Controls("Comliebie")
        If .Value IsNot Nothing Then
            If Filter > "" Then
                Filter = Filter & " And "
            End If
            Filter = Filter & "bh= '" & .Value & "'"
        End If
    End With
ElseIf e.Form.Controls("raddanwei").Checked = True

    Dim Filter As String = ""
    With e.Form.Controls("Comliebie")
        If .Value IsNot Nothing Then
            Filter = "wzmc= '" & .Value & "'"
        End If
    End With
    With e.Form.Controls("Comliebie")
        If .Value IsNot Nothing Then
            If Filter > "" Then
                Filter = Filter & " And "
            End If
            Filter = Filter & "bh= '" & .Value & "'"
        End If
    End With

End If


 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:107680 积分:547721 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2017/6/23 21:00:00 [只看该作者]

第一和第二行代码去掉。

要用也是这样用呀,提示这么明显咯

Dim cmb1 As WinForm.RadioButton = e.Form.Controls("radweixian")

 回到顶部
帅哥哟,离线,有人找我吗?
1131369760
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:婴狐 帖子:15 积分:170 威望:0 精华:0 注册:2017/6/22 20:51:00
  发帖心情 Post By:2017/6/23 21:44:00 [只看该作者]

还是无法实现功能呀

 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:107680 积分:547721 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2017/6/23 21:59:00 [只看该作者]

你想实现什么功能啊。

最后加上

If Filter > "" Then
    Tables(
"订单").Filter = Filter
End If

 回到顶部