|
GAOZHONG 发表于 2011-4-8 11:10
我的目的可以查看
请帮忙解决子报表数据排列的问题,急!
http://www.office-cn.net/forum-viewthread-ti ...
你什么都不会呀,呵呵。
1、写一个自定义函数:
function valUpdate()
dim rs as new adodb.recordset
dim rs0 as new adodb.recordset
dim i as long,j as long
rs.Open "你的数据表名称", CurrentProject.Connection, adOpenKeyset, adLockOptimistic
rs0.Open "你的临时数据表名称", CurrentProject.Connection, adOpenKeyset, adLockOptimistic
if rs0.recordcount>0 then
for i=1 to rs0.recordcount
rs0.delect
rs0.update
next
end if
for i=1 to rs.recordcount
fro j=0 to rs.fileds.count-1
if rs.filds(j).name="数据1" or rs.filds(j).name="数据2" or rs.filds(j).name="数据3" then
if nz(rs.filds(j).value,0)<>0 then
rs0.addnew
rs0("临时表中的字段名称").value=rs.filds(j).value
rs0.update
end if
end if
next
rs.movenext
next
rs.close:set rs=noting
rs0.close:set rs0=nothing
end function
2、在某个按钮事件中调用该函数:
call valUpdate |
|