Office中国论坛/Access中国论坛

标题: 求助:错误提示---类型不匹配 [打印本页]

作者: kennylee    时间: 2006-1-23 08:07
标题: 求助:错误提示---类型不匹配
请各位帮忙:

rs("数量") = DCount("[序号]", "测定表", "[实测值] > " & Lc And "[实测值] < " & Uc)
错误提示:类型不匹配

Option Compare Database
Option Explicit
Public Sub AAA(MIN As Double, MAX As Double) '将测定表的实测值分组统计表
Dim R As Double '全距
Dim C As Double '组距
Dim L As Double '最小一组的下组界
Dim U As Double '最小一组的上组界
Dim Lc As Double '最小一组的下组界
Dim Uc As Double '最
Dim i
Dim dbs As Database '数据库
Dim rs As Recordset '代表指定记录源
Set dbs = CurrentDb
Set rs = dbs.OpenRecordset("统计表") '记录源


R = MAX - MIN
C = Format(R / (Forms![数据统计]![组数] - 1), "##0.00") '组距
L = MIN - 0.1 / 2
U = L + C


For i = 0 To (Forms![数据统计]![组数] - 1)
Lc = L + C * i
Uc = U + C * i


rs.AddNew '新增
rs("组号") = i + 1
rs("组距") = C
rs("最小值") = Lc
rs("最大值") = Uc
rs("数量") = DCount("[序号]", "测定表", "[实测值] > " & Lc And "[实测值] < " & Uc)
rs.Update '更新
Stop
Next
dbs.Close '关闭
End Sub



'调用 Call AAA(DMin("实测值", "测定表"), DMax("实测值", "测定表"))






作者: 情比金坚    时间: 2006-1-23 08:57
rs("数量") = DCount("[序号]", "测定表", "[实测值] > " & Lc & "And [实测值] < " & Uc)

作者: kennylee    时间: 2006-1-24 06:20
OK !

多谢大侠指点!




欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/) Powered by Discuz! X3.3