Dim rscode As New ADODB.Recordset
...................
Set RsCode = zwpub.DataMdb.DbConnect.Execute("select Dend from code where ccode = N'" & curYHKM & "' and iyear=" & zwpub.QueryYear, dbOpenDynaset)
RsCode.Open "select Dend from code where ccode = N'" & curYHKM & "' and iyear=" & zwpub.QueryYear, zwpub.DataMdb.DbConnect, adOpenDynamic, adLockOptimistic
在vb中应用execute打开数据表,通常不能修改 ,如修改,应该用open.