|
本帖最后由 todaynew 于 2014-12-30 11:27 编辑
写个子程序不就完事了
sub Transition(oldtbname as string,newtbname as string)
dim rs1 as new adodb.recordset,rs2 as new adodb.recordset
dim i as long,j as long
rs1.Open oldtbname, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
rs2.Open newtbname, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
for i=1 to rs1.RecordCount
for j=2 to rs1.fields.count-1
if rs1.fields(j).name like "项目*" then
rs2.addnew
rs2!日期.value=rs1!日期.value
rs2!类目.value=rs1!类目.value
rs2!项目.value=rs1.fields(j).name
rs2!金额.value=rs1.fields(j).value
rs2.update
end if
next
rs1.movenext
next
rs1.close:set rs1=nothing
rs2.close:set rs2=nothing
end sub
|
|