|
求助:access老是提示If rst.Fields("编号").Value = rst1.Fields("编号").Value Then这句代码出错,请问正确的应该如何编写??谢谢先。
Private Sub aa()
Dim cnn As ADODB.Connection, rst As ADODB.Recordset, rst1 As ADODB.Recordset
Set cnn = New ADODB.Connection: Set rst = New ADODB.Recordset: Set rst1 = New ADODB.Recordset
Dim i As Integer
i = 0
cnn.Open "provider=microsoft.jet.oledb.4.0;" & _
"data source=c:\db1.mdb;"
rst.Open "附件", cnn
rst1.Open "附件1", cnn
rst.MoveFirst
Do Until rst.EOF
rst.MoveNext
rst1.MoveFirst
Do Until rst1.EOF
If rst.Fields("编号").Value = rst1.Fields("编号").Value Then
i = i + 1
End If
rst1.MoveNext
Loop
Loop
rst.Close
Set rst = Nothing
rst1.Close
Set rst1 = Nothing
cnn.Close
Set cnn = Nothing
Debug.Print i
End Sub
|
|