【问题标题】:Problems of wording in a Dcount functionDcount 函数中的措辞问题
【发布时间】:2015-07-10 07:21:15
【问题描述】:

在 click() 上,我遇到以下问题或措辞:

Private Sub Cmd_Create_Click()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim rs_conterparty As DAO.Recordset
Dim rsCount As Integer
Dim PE_nb As Integer
Dim BizNO As Field
Dim YearMonth As Field
Dim i, j, k, l, m, n As Integer

Set db = CurrentDb()
Set rs = db.OpenRecordset("TRD_ListofBiz")
Set BizNO = rs.Fields("BizNO")
Set YearMonth = rs.Fields("Year/Month of Delivery")

rs.MoveLast
rsCount = rs.RecordCount

Department = Me!Label_deal_status.Value
PE_nb = [Forms]![MAIN_PHYSICAL]![TRD_CONTERPARTY_PRI_VIEW]![TRD_Pricing-In]!Count

MsgBox (DCount("Year/Month of Delivery", "TRD_ListofBiz", "[Year/Month of Delivery]= '" & Me.Txt_entry & "'"))

我不明白为什么 DCount 函数不起作用,尽管 Msgbox 很好地检索了“me.Txt_entry”

感谢您的帮助。

【问题讨论】:

  • 它做了什么而不是工作?
  • 会出现一个消息框,提示“运行时错误 '3075':查询表达式 'Count(Year/ Month of Delivery)' 中的语法错误(缺少运算符)。”
  • 用方括号括起来 ([])
  • 工作完美,谢谢。现在我想添加第二个条件,它是一个字符串,但它不起作用: MsgBox (DCount("[Year/Month of Delivery]", "TRD_ListofBiz", "[Year/Month of Delivery]= '" & Me .Txt_entry & "' AND [SH_underlying]='TRADING'")
  • 对不起,我很笨,错过了最后一个括号......

标签: ms-access vba dcount


【解决方案1】:

试试这个:

MsgBox (DCount("[Year/Month of Delivery]", "TRD_ListofBiz", "[Year/Month of Delivery]= '" & Me.Txt_entry & "'"))

【讨论】:

    猜你喜欢
    • 2015-07-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-02-17
    • 2019-11-02
    • 2011-07-12
    • 2023-04-05
    • 1970-01-01
    相关资源
    最近更新 更多