返回月份日期输入星期日期时的数据

返回月份日期输入星期日期时的数据

问题描述:

我有一个表格设置,每月都会有一堆数字。我正在设置一个查询将其分解为每周数字。我如何使查询返回正确的数据?返回月份日期输入星期日期时的数据

这就是我想要的数据出来(在Excel):

enter image description here

这是access-programmers.co.uk跨岗位。

如果你想使用一个从,你可以做这样的:

FIELD: YourDateField 
CRITERIA: Between FORMS![YourFormName]!cboStartDate and Forms![YourFormName]!cboEndDate 

如果你想使用VBA,你能做到这样。

Dim strWhere As String 
Dim conJetDate ="\#mm\/dd\/yyyy\#" 
If IsNull(Me.cboStartDate) Or IsNull(Me.cboEndDate) Then 
MsgBox "Both dates needed" 
Else 
strWhere = "[MyDate] Between " & _ 
Format(Me.cboStartDate, conJetDate) & " And " & _ 
Format(Me.cboEndDate, conJetDate) 
Me.Filter = strWhere 
Me.FilterOn = True 
End If