1

Topic: Excel Recordset.edit erorr MS2008R

Children prompt please.
In excel I create connection to MS2008R, I load the data in Recordset and I want to change value in the table.
To add  a line works, and here to change an error 438 Object does not support this property or method
I want to try to make through editing rs.

Dim cn As Object
Dim rs As Object
Dim sql As String
Set cn = CreateObject ("ADODB.Connection")
cn. ConnectionString = "Provider=SQLOLEDB.1; Integrated Security=SSPI; server=srv19"
cn. Open
Set rs = CreateObject ("ADODB.Recordset")
sql = "select gender from test_r"
rs. Open sql, cn, 3, 3
rs. Edit ' an error 438 Object does not support this property or method
' rs.addnew
rs. Fields ("gender").Value = "123"
rs. Update

2

Re: Excel Recordset.edit erorr MS2008R

Focha, you incorrectly do all.
It is necessary so:

rs. Open sql, cn, 3, 3 ' - it is not assured  regularities well 
with rs
.MoveFirst
Do While (.EOF = False)
.Fields ("gender") = "123"
.MoveNext
Loop
.update
.Close
End With

3

Re: Excel Recordset.edit erorr MS2008R

wrote:

Focha, you incorrectly do all.
It is necessary so:

rs. Open sql, cn, 3, 3 ' - it is not assured  regularities well 
with rs
.MoveFirst
Do While (.EOF = False)
.Fields ("gender") = "123"
.MoveNext
Loop
.update
.Close
End With

Thanks, earned all.

rs. Fields ("gender").Value = "123"
rs. Update