我也出现同样错误, Sub H_单个工程指标入库_MDB() Dim Sql$ Dim strFile, strConnStr As String Dim Conn As New ADODB.Connection Dim rs1 As New ADODB.Recordset 'http://www.connectionstrings.com这里有连接字符串如何定义的内容,如果出现错误往往是连接字符串出 strFile = Application.GetOpenFilename("Access文件,*.mdb", , , , False) strConnStr = "data source =" & strFile '可能要注意空格有文件是否要引起来 With Conn .Provider = "Microsoft.Jet.OLEDB.4.0" .ConnectionString = strConnStr .Open End With Sql = "select Aa,BB from Sheet1" '设置查询条件 With rs1 .CursorType = adOpenKeyset .LockType = adLockPessimistic End With Set rs1 = Conn.Execute(Sql) rs1.AddNew '这句运行就出现这个错误!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! rs1.Fields("AA").Value = "新工程01" rs1.Fields("BB").Value = "公寓" rs1.Update rs1.Close '关闭数据集 Conn.Close '关闭连接 Set Conn = Nothing '释放内存 Application.ScreenUpdating = True End Sub
=================== 我也是同样错误,请高人指点.
[此贴子已经被作者于2007-12-28 23:28:20编辑过] |