Office中国论坛/Access中国论坛

标题: 为什么执行该语句后扔无变化 [打印本页]

作者: alice1234    时间: 2009-7-2 19:39
标题: 为什么执行该语句后扔无变化
为什么使用截取语句后没有将AND去掉?
作者: koutx    时间: 2009-7-3 08:34
改为:
If Len(strWhere) >5 Then
试试
作者: nxjswt    时间: 2009-7-3 10:26
一个例子

Private Sub Command13_Click()
On Error GoTo Err_Command13_Click

    '查询语句
    Me.Refresh
    Dim strWhere As String
    strWhere = ""
   
        
    If Not IsNull(Me.帐号) Then
        strWhere = strWhere & "([帐号] like '*" & Me.帐号 & "*') AND "
    End If
     If Not IsNull(Me.备注) Then
        strWhere = strWhere & "([备注] like '*" & Me.备注 & "*') AND "
    End If
   
            
    '==========================================================
    If Len(strWhere) > 0 Then
        strWhere = Left(strWhere, Len(strWhere) - 5)
    End If

    Me.frmChaxun1.Form.FilterOn = True
    Me.frmChaxun1.Form.Filter = strWhere
   
   
    '为了记录计数正确,使用这个语句
    Me.frmChaxun1.Form.Recordset.MoveLast
   
    '显示查询结果计数
        
    If Me.查询记录计数 = 0 Then
          MsgBox "没有查询到任何记录!", vbExclamation, "注意!"
        Else
          MsgBox "当前查询到" & Me.查询记录计数 & "条记录!", vbInformation, "注意!"
    End If
   
Exit_Command13_Click:
    Exit Sub

Err_Command13_Click:
    MsgBox Err.Description
    Resume Exit_Command13_Click
   
End Sub
作者: 轻风    时间: 2009-7-3 11:03
仅此图看不出来,看代码应该没错。你把断点设到下一句再截图看看有没有截掉。
作者: alice1234    时间: 2009-7-3 11:10
还是没截掉,怎么办?
作者: alice1234    时间: 2009-7-3 11:19
这回截掉AND了,但是查询后子窗体内容好像没有执行过滤,总是显示全部信息
作者: alice1234    时间: 2009-7-3 13:02
请求帮助解决楼上的问题
作者: 轻风    时间: 2009-7-3 14:51
不会吧,上传看看
作者: alice1234    时间: 2009-7-3 15:33
上传,请指教
作者: alice1234    时间: 2009-7-4 09:19
怎么没人说




欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/) Powered by Discuz! X3.3