【问题标题】:Return Month Date Data when Week Date is entered输入周日期时返回月日期数据
【发布时间】:2016-11-28 21:56:58
【问题描述】:

我有一个表格设置,上面有一堆按月给出的数字。我正在设置一个查询以将其分解为每周数据。如何让查询返回正确的数据?

这就是我希望数据输出的方式(在 Excel 中):

这是来自access-programmers.co.uk的交叉帖子。

【问题讨论】:

    标签: date ms-access datepart


    【解决方案1】:

    如果你想使用 From,你可以这样做:

    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
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-08-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多