

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