# 错在那里

Posted by Eric on September 06, 1998 at 17:28:33:

Private Sub Command1_Click()
Dim a As String
Dim b As String
Dim xa As Integer
Dim xb As Single
Dim xc As Single
Dim rs As Recordset
Dim r1 As Recordset
Dim r2 As Recordset
'按键锁定
Command1.Enabled = False
Command1.Visible = False
Command2.Enabled = False
Command2.Visible = False
Screen.MousePointer = 11
Label1.Caption = "开始资料库重整,工作中........"

'sql资料
Set rs = iBase.OpenRecordset("select 异动库.[出货单号] as xx, [未出数量] from 订单库 inner join 异动库 on [订单库].[订单号] = [异动库].[出货单号]", dbOpenDynaset)

rs.MoveLast: rs.MoveFirst
xa = Int(10000 / rs.RecordCount)
xc = 0
iWorkspace.BeginTrans
Do Until rs.EOF
a = "select sum([出货数量]) as x1 from [异动库] where [出货单号] = '" & rs!xx & "'"
b = "select sum([订货数量]) as x2 from [订单库] where [订单号] = '" & rs!xx & "'"
Set r1 = iBase.OpenRecordset(a, dbOpenSnapshot)
Set r2 = iBase.OpenRecordset(b, dbOpenSnapshot)
rs.Edit
rs!未出数量 = r2!X2 - r1!X1
rs.Update
rs.MoveNext
xc = xc + xa
ProgressBar1.Value = xc
Loop
iWorkspace.CommitTrans

'按键开起
Command1.Enabled = True
Command1.Visible = True
Command2.Enabled = True
Command2.Visible = True
Label1.Caption = "结算完成...请按结束键离开......."
Screen.MousePointer = 1

rs.edit总是报说不能修改

谢谢指点

Follow Ups:

- Re: 错在那里 小吴 07:32:36 9/07/98 (0)