Comparing (String) Column Values for RecordSets

scm24

New member
Joined
Nov 18, 2005
Messages
1
Programming Experience
1-3
I receive a "No Current Record" error when I execute this code. The fields/records contain this verbiage:

"Berry, Kimyra"

Private Sub Command0_Click()
Dim strSQL As String
Dim db1 As DAO.Database
Dim qdf1 As DAO.QueryDef
Dim updRecordSet As DAO.Recordset
Dim db2 As DAO.Database
Dim qdf2 As DAO.QueryDef
Dim exstRecordSet As DAO.Recordset
Dim db3 As DAO.Database

DoCmd.OpenQuery "qryGAL" 'Make table tblLFD_GAL_New through query
DoCmd.Close acQuery, "qryGAL"

Set db1 = CurrentDb() 'Getting first RecordSet
Set qdf1 = db1.CreateQueryDef("")
qdf1.SQL = "Select First, Last, Full, Title FROM tblLFD_GAL_New;"
Set updRecordSet = qdf1.OpenRecordset()

Set db2 = CurrentDb() 'Getting second RecordSet
Set qdf2 = db2.CreateQueryDef("")
qdf2.SQL = "Select First, Last, Full, Title FROM tblLFD_GAL;"
Set exstRecordSet = qdf2.OpenRecordset()

Set db3 = CurrentDb()

Do Until updRecordSet.EOF
Do Until exstRecordSet.EOF
If updRecordSet("Full") = exstRecordSet("Full") Then
updRecordSet.Delete 'Deleting all dups out of RecordSet
Else
exstRecordSet.MoveNext
End If
Loop

updRecordSet.MoveNext
exstRecordSet.MoveFirst
Loop

updRecordSet.MoveFirst

If updRecordSet.RecordCount = 0 Then
Exit Sub
Else
Do Until updRecordSet.EOF 'Inserting all remaining RecordSets
db3.Execute "INSERT INTO tblLFD_GAL(first, last, full, title) VALUES('" & updRecordSet.Fields(0).Value & "', '" & updRecordSet.Fields(1).Value & "', '" & updRecordSet.Fields(2).Value & "', '" & updRecordSet.Fields(3).Value & "');"
updRecordSet.MoveNext
Loop
End If

updRecordSet.Close 'Closing RecordSets
exstRecordSet.Close
Set updRecordSet = Nothing
Set exstRecordSet = Nothing

End Sub
 
You're all out to get me aren't you. I need to stop coming here.... it can only lead to my early demise.

This may come out wrong, but I don't care at this point.... but..... What the heck are you doing using DAO in .NET?

Read up on ADO.NET. Use the OLEDBClient or ODBCClient.... but jeez, dump DAO.

-tg
 
Back
Top