菜鸟求助 vb实时错误3021
Bof或者Eof中有一个是真,或者当前的纪录已被删除,所需的操作要求一个当前的纪录??这是什么意思?程序又错在哪里?要怎么改?
Function CopyRecordSetUpdatable(ByVal rs As ADODB.Recordset, ByVal mfg As MSHFlexGrid) As ADODB.Recordset
Dim rsReturn As ADODB.Recordset
Dim fld As ADODB.field
Dim lFieldsCount As Long
Dim vIndexs() As Variant
Dim vValues() As Variant
Dim i As Long
lFieldsCount = rs.Fields.count
ReDim vIndexs(lFieldsCount - 1)
ReDim vValues(lFieldsCount - 1)
Set rsReturn = New ADODB.Recordset
For i = 0 To lFieldsCount - 1
Set fld = rs.Fields(i)
vIndexs(i) = i
rsReturn.Fields.Append fld.name, fld.Type, fld.DefinedSize, fld.Attributes Or adFldUnknownUpdatable
Next
rsReturn.Open
While Not rs.BOF
For i = 0 To lFieldsCount - 1
vValues(i) = mfg.TextMatrix(10, i)
Next
rsReturn.AddNew vIndexs, vValues
rs.MoveNext
Wend
If Not rsReturn.BOF Then
rsReturn.UpdateBatch
rsReturn.MoveFirst
End If
Set CopyRecordSetUpdatable = rsReturn
End Function
[解决办法]
Set fld = rs.Fields(i) & ""
[解决办法]
if isnull(rs.Fields(i))=false then
Set fld = rs.Fields(i)
endif