|
本帖最后由 li_wanli 于 2013-6-5 09:37 编辑
在"按日期查询"(query)添加单击事件
Private Sub query_Click()
On Error GoTo Err_query_Click
Dim strWhere As String
strWhere = ""
If Not IsNull(Me.开始日期) Then
strWhere = strWhere & "([日期] >= #" & Format(Me.开始日期, "yyyy-mm-dd") & "#) AND "
End If
If Not IsNull(Me.截止日期) Then
strWhere = strWhere & "([日期] <= #" & Format(Me.截止日期, "yyyy-mm-dd") & "#) AND "
End If
If Len(strWhere) > 0 Then
strWhere = Left(strWhere, Len(strWhere) - 5)
End If
Me.Form.Filter = strWhere
Me.Form.FilterOn = True
Exit_query_Click:
Exit Sub
Err_query_Click:
MsgBox Err.Description
Resume Exit_query_Click
End Sub |
|