本帖最后由 chzj589 于 2019-7-16 08:13 编辑
怪事,在我建立的数据库就能通过。
整列合计吧
Local $ri1 = @MDAY
$addfld = ObjCreate("ADODB.Connection")
$addfld.Open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & $mdb_data_path & ";Jet Oledb:Database Password=" & $mdb_data_pwd)
$RS = ObjCreate("ADODB.Recordset")
$RS.ActiveConnection = $addfld
Local $xszh, $xszh1
;$RS.open("SELECT * FROM 07yue")
$RS.open("SELECT * FROM 07yue WHERE rq<=" & $ri1 )
While Not $RS.eof And Not $RS.bof
If @error = 1 Then ExitLoop
$xszh += $RS.Fields(2).value
$xszh1 += $RS.Fields(3).value
;MsgBox(0,"",$xszh)
$RS.movenext
WEnd
MsgBox(0,"","目标数据合计 "&$xszh& @CRLF &"销售数据合计 "&$xszh1)
$RS.close
$addfld.Close
|