DCount
我对函数标准的措辞有疑问。
在click()
我想根据在名为“Txt_entry”的入站字段中输入的值来获取故事中字段“YearMonth”的出现次数。
我的代码忽略了给定的标准(并返回 0),因为它的措辞是错误的,但我不知道什么是正确的措辞。
Private Sub Ctl3_Click()
Dim db As Database
Dim r As Recordset
Dim YearMonth As Field
Dim Txt_entry As String
Set db = CurrentDb()
Set r = db.OpenRecordset("Table")
Set YearMonth = r.Fields("YearMonth")
MsgBox (DCount("YearMonth", "Table", "[YearMonth]=" & Me.Txt_entry))
End Sub
谢谢!