|
作库存查询.在输入货物名称,得到该货物的详细领取记录,我想把领出的数目求和.
Set dbs = Application.CurrentData
For Each obj In dbs.AllQueries
If (obj.Name = "库存查询") Then
CurrentDb.QueryDefs.Delete obj.Name
End If
Next obj
Dim strSQL1 As String
Dim a As Integer
strSQL1 = " select 领货表.* from 领货表 where (领货表.mc like " & valhwmc & " )"
q = CurrentDb.CreateQueryDef("库存查询", strSQL1)
DoCmd.OpenQuery "库存查询", , acReadOnly
Dim 库存查询 As Recordset
a = 0
Do While Not 库存查询.EOF
If 库存查询.EOF Then
Exit Do
a = a + 库存查询("lcs")
库存查询.MoveNext
Else
库存查询.MoveNext
End If
Loop
改如何改正,且a的值如何显示出来或在表中加入一列显示
求各位大侠救我
email sdjyk2003@mail.china.com |
|