|
将For J = 2 To RST.RecordCount + 1
For I = 0 To lk - 1
.Cells(J, I + 2).Value = "'" & RST.Fields(I).Value
Next
' Sql = "select 客户简称 from 客户档案 where 客户编号 like'" & .Cells(J, 3).Value & "'"
' RSTby.Open Sql, CNN, adOpenKeyset, adLockOptimistic
' .Cells(J, 3).Value = RSTby.Fields("客户简称").Value
' Set RSTby = Nothing
' Sql = "select 姓名 from 业务员档案 where 业务员编号 like'" & .Cells(J, 4).Value & "'"
' RSTby.Open Sql, CNN, adOpenKeyset, adLockOptimistic
' .Cells(J, 4).Value = RSTby.Fields("姓名").Value
' Set RSTby = Nothing
' Sql = "select * from 磁碟号档案 where 磁碟号 like'" & .Cells(J, 5).Value & "'"
' RSTby.Open Sql, CNN, adOpenKeyset, adLockOptimistic
' .Cells(J, lk + 2).Value = RSTby.Fields("产品名称").Value
' .Cells(J, lk + 3).Value = RSTby.Fields("产品规格").Value
' Set RSTby = Nothing
RST.MoveNext
Next
改 为 :
Range("B2").CopyFromRecordset RST
试 一 试 |
|