|
Set rst.ActiveConnection = cnn
rst.CursorLocation = adUseClient
rst.CursorType = adOpenDynamic
strSQL = "SELECT 菜品编号, 菜品名称, " & _
"计量单位 as 单位, " & _
"Sum(数量) AS 合计数量, " & _
"Sum(金额) AS 合计金额, " & _
"[合计金额]/[合计数量] AS 平均单价 " & _
"From 营业状态_中间表 " & _
"WHERE ((点菜日期 Between " & _
"#" & strStart & "#" & " And " & _
"#" & strEnd & "#" & ")) " & _
" GROUP BY 菜品编号, 菜品名称, " & _
"计量单位;"
' Debug.Print strSQL
Set fg.DataSource = Nothing
rst.Open strSQL
'Debug.Print rst.RecordCount
'While Not rst.EOF
' i = i + 1
' rst.MoveNext
'Wend
如果用debug.print rst.recordCount 就是出个这错误
或者 While Not rst.EOF
i = i + 1
rst.MoveNext
'Wend
到记录78行时,就要出这个错误.(rst.movenext这句)
但用debug.print strSQL 的值到Acess中建立查询,却有180行的记录。 |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
|