将 DCount 函数与链接到控件的查询一起使用
Using DCount function with a query linked to a control
以下代码给我一条语法错误消息。我想在表单的当前事件上使用 DCount 函数来计算 table 中的记录,其中控件 'TeamID' 上的值等于 'teamID' 字段中的值 table 'tblCompetency06'
Me.etcRecordNumber.Caption = "Record " & Me.CurrentRecord & " of " & DCount("ID", "tblCompetency06") WHERE [tblcompetency06].[teamID]= '" & me.Teamid & "'"
可能有两个原因,一个是您对 DCount 使用了错误的语法。其次,您是 using/comparing 数字数据类型,并且正在与字符串进行比较。请尝试以下操作。
Me.etcRecordNumber.Caption = "Record " & Me.CurrentRecord & " of " & _
DCount("*", "tblCompetency06", "[teamID]= " & me.Teamid)
以下代码给我一条语法错误消息。我想在表单的当前事件上使用 DCount 函数来计算 table 中的记录,其中控件 'TeamID' 上的值等于 'teamID' 字段中的值 table 'tblCompetency06'
Me.etcRecordNumber.Caption = "Record " & Me.CurrentRecord & " of " & DCount("ID", "tblCompetency06") WHERE [tblcompetency06].[teamID]= '" & me.Teamid & "'"
可能有两个原因,一个是您对 DCount 使用了错误的语法。其次,您是 using/comparing 数字数据类型,并且正在与字符串进行比较。请尝试以下操作。
Me.etcRecordNumber.Caption = "Record " & Me.CurrentRecord & " of " & _
DCount("*", "tblCompetency06", "[teamID]= " & me.Teamid)