Access开发培训
网站公告
·Access专家课堂QQ群号:151711184    ·Access快速开发平台下载地址及教程    ·欢迎加入Access专家课堂微信群!    ·如何快速搜索本站文章|示例|资料    
您的位置: 首页 > 技术文章 > 源码示例

根据查找窗体设定的条件筛选主窗体的数据内容代码

时 间:2009-03-15 17:06:23
作 者:红尘如烟   ID:3459  城市:保定
摘 要:应用环境为:在弹出窗体中设定查找条件,然后据此筛选状体中的数据
正 文:

If Me.开始日期 > Me.截止日期 Then
        MsgBox "您选择的开始日期晚于截止日期!", vbExclamation, "错误"
    Else
        Dim strWhere As String
        strWhere = True

        If Not IsNull(Me.开始日期) Then
            If Not IsNull(Me.截止日期) Then
                strWhere = strWhere & " and [车辆注册日期] between #" & Me!开始日期 & "# and #" & Me.截止日期 & "#"
            Else
                strWhere = strWhere & " and [车辆注册日期] >= #" & Me.开始日期 & "#"
            End If
        Else
            If Not IsNull(Me.截止日期) Then
                strWhere = strWhere & " and [车辆注册日期] <= #" & Me.截止日期 & "#"
            End If
        End If


        If Not IsNull(Me.车号) Then
            strWhere = strWhere & " and [车号] Like '*" & Me.车号 & "*'"
          
        End If

        If Not IsNull(Me.车型) Then
            strWhere = strWhere & " and [车型] = '" & Me.车型 & "'"
        End If

        With Forms!主控面板!Child0.Form!车辆信息_child.Form
            .Filter = strWhere
            .FilterOn = True
        End With
        DoCmd.Close acForm, Me.Name, acSaveNo



Access软件网官方交流QQ群 (群号:483923997)       Access源码网店

常见问答:

技术分类:

相关资源:

专栏作家

关于我们 | 服务条款 | 在线投稿 | 友情链接 | 网站统计 | 网站帮助