|
To lgpldn:
我的做法和版主的一样,只是临时表"Order"隐藏了.
加了“模块1“处理Order表,打开报表会调用模块1的程式运行。
报表数据源联合了Order表,用了ADO ,做法没有版主的简洁。版主的程式我在学习时改了一下,
也贴上:
Sub MyData3()
Dim rst As DAO.Recordset, i As Integer, j As Integer
Dim Rst1 As DAO.Recordset
Dim k%, stSQL$
stSQL = "select max(订单.件数) as Total1 from [订单]"
Set Rst1 = CurrentDb().OpenRecordset(stSQL, dbOpenForwardOnly, dbReadOnly)
k = Rst1!Total1
CurrentDb().Execute "delete * from [num]"
Set rst = CurrentDb().OpenRecordset("Num")
For i = 1 To k
For j = 1 To i
rst.AddNew
rst!num = i
rst.Update
Next
Next
End Sub
|
|