界面/窗体/控件
根据查找窗体设定的条件筛选主窗体的数据内容代码
2009-03-16 09:33:20

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