Hello!
I am new to VB 6.0. Currently I am doing some data pre-processing for a project, and not being good in VB I had difficulty in something.

Suppose I have two tables in MS access:
1) Jan2006
2) Feb2006

And these two tables have equal number columns. My focus is only to select a column named "CustomerNo" in both Tables in my MS access database (I converted from excel files using VB 6.0).

I am trying to find the common elements in both the CustomerNo columns in Jan2006 and Feb2006, using VB 6.0 (rs.find) currently, however I am unable to do so. After finding the common elements I wish to extract them into a new table and then go ahead with my other data files.

Exceptions:
(1) There are duplicate values in the CustomerNo column, which need to be skipped, when the common values are extracted
(2) I have 50,000+ rows of data, resulting in 600MB db file for pre-processing in this manner, needed a fast and optimizable way
(3) The number of rows are not same in any of the "CustomerNo" columns. However the data is numerical value like:

TABLE: JAn2006
CustomerNo
00200002
00200003
00200004
00200005
00200006
00200006
00200007
00200008
00200010
00200011
00200012
00200015
00200016
00200020

TABLE: Feb2006
CustomerNo
00200002
00200003
00200004
00200005
00200007
00200008
00200010
00200011
00200012
00200015
00200016
00200021
00200022

Here is the code I was working on, currently having a problem with the pointers using rs.find:

Code:
Dim cn            As New ADODB.Connection
Dim cnstr         As String
Dim sql           As String
Dim rs1           As New ADODB.Recordset
Dim rs2           As New ADODB.Recordset
Dim rs3           As New ADODB.Recordset
Dim strFilePath   As String
Dim strloop       As String

strFilePath = App.Path & "\data.mdb"
cnstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strFilePath & ";"

cn.Open cnstr
sql1 = "SELECT CustomerNo FROM Jan2006"
sql2 = "SELECT CustomerNo FROM Feb2006"

Set rs1 = cn.Execute(sql1)
Set rs2 = cn.Execute(sql2)



Do Until rs2.EOF
   rs1.MoveFirst
   strloop = rs1.Fields("CustomerNo").Value
   MsgBox rs1.Fields("CustomerNo").Value
   rs2.Find ("CustomerNo='strloop'"), , adSearchForward, 1
   
If (rs2.EOF = True) Then
Debug.Print rs1.Fields("CustomerNo")
End If

rs2.MoveNext
Loop

rs1.Close
rs2.Close

End Sub