|
Access 工程模式写如下代码,运行到红色字时报错,提示运行时错误'-2147217900'(80040e14);无效的SQL语句这段代码在同一文件的其他地方也用导了,运行正常,实在找不到什么原因,求大神支持
Dim rs1 As New ADODB.Recordset, rs2 As New ADODB.Recordset
Dim oldtbname As String
Dim newtbname As String
Dim i As Long, j As Long
oldtbname = "Project Total"
newtbname = "Project Total2"
rs1.Open oldtbname, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
rs2.Open newtbname, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
For i = 1 To rs1.RecordCount
For j = 6 To rs1.Fields.Count - 1
rs2.AddNew
rs2!Project_Owner.Value = rs1!Project_Owner.Value
rs2!Project_Manager.Value = rs1!Project_Manager.Value
rs2!Client_Name.Value = rs1!Client_Name.Value
rs2!Client_Type.Value = rs1!Client_Type.Value
rs2!Project.Value = rs1!Project.Value
rs2!Month.Value = rs1!Month.Value
rs2!类别.Value = rs1.Fields(j).Name
rs2!数值.Value = rs1.Fields(j).Value
rs2.Update
Next
rs1.MoveNext
Next
rs1.Close: Set rs1 = Nothing
rs2.Close: Set rs2 = Nothing
|
|