北京 | 上海 | 天津 | 重庆 | 广州 | 深圳 | 珠海 | 汕头 | 佛山 | 中山 | 东莞 | 南京 | 苏州 | 无锡 | 常州 | 南通 | 扬州 | 徐州 | 杭州 | 温州 | 宁波 | 台州 | 福州 | 厦门 | 泉州 | 龙岩 | 合肥 | 芜湖 | 成都 | 遂宁 | 长沙 | 株洲 | 湘潭 | 武汉 | 南昌 | 济南 | 青岛 | 烟台 | 潍坊 | 淄博 | 济宁 | 太原 | 郑州 | 石家庄 | 保定 | 唐山 | 西安 | 大连 | 沈阳 | 长春 | 昆明 | 兰州 | 哈尔滨 | 佳木斯 | 南宁 | 桂林 | 海口 | 贵阳 | 西宁 | 乌鲁木齐 | 包头 |
各位大神,我在编窗体多条件查询时候,查询功能一直有问题,如下。
1. 输入VAK号或者日期进行查询时,有时候会报错标注表达式中数据类型不匹配
2.输入其它几个文本查询时,有时候成功,有时候失败
3.多条件综合查询时,查询结果都为空
代码如下
Private Sub 查询_Click()
'On Error GoTo err_查询_click '错误处理
strwhere = ""
If Not IsNull(VAK号1) Then
strwhere = strwhere & "([VAK号]>=[Forms]![F061_VAK号查询修改]![VAK号1]) and "
End If
If Not IsNull(VAK号2) Then
strwhere = strwhere & "([VAK号]<=[Forms]![F061_VAK号查询修改]![VAK号2]) and "
End If
If Not IsNull(客户) Then
strwhere = strwhere & "([客户] LIKE '*'& [Forms]![F061_VAK号查询修改]![客户]& '*') and "
End If
If Not IsNull(收到日期1) Then
strwhere = strwhere & "([收到日期]>=[Forms]![F061_VAK号查询修改]![收到日期1]) and "
End If
If Not IsNull(收到日期2) Then
strwhere = strwhere & "([收到日期]<=[Forms]![F061_VAK号查询修改]![收到日期2]) and "
End If
If Not IsNull(产品) Then
strwhere = strwhere & "([产品] like '*'& [Forms]![F061_VAK号查询修改]![产品]&'*') and "
End If
If Not IsNull(申请日期1) Then
strwhere = strwhere & "([申请日期]>=[Forms]![F061_VAK号查询修改]![申请日期1]) and "
End If
If Not IsNull(申请日期2) Then
strwhere = strwhere & "([申请日期]<=[Forms]![F061_VAK号查询修改]![申请日期2]) and "
End If
If Not IsNull(备注) Then
strwhere = strwhere & "([备注] LIKE '*'&[Forms]![F061_VAK号查询修改]![备注]& '*') and "
End If
If Len(strwhere) > 0 Then
strwhere = Left(strwhere, Len(strwhere) - 5)
Else
MsgBox "请输入查询信息!", vbOKOnly + vbExclamation, "提示"
Exit Sub
End If
Me.F0611_VAK信息查询子窗体.Form.Filter = strwhere
Me.F0611_VAK信息查询子窗体.Form.FilterOn = True
exit_查询_click:
Exit Sub
err_查询_click: '错误处理
MsgBox (Err.Description)
Resume exit_查询_click
End Sub