I have to write a code where I have 2 tables table 1 and table 2 which are
similar structures. I got to insert only those records which are not found
based on a key field called rec_isn
So I am trying to do something like this in access forms coding.. but it
dosent work... plz help...
Gives me type mismatch on set rs = "select ..."
Private Sub CmdImpDB_Click()
Dim SQL As String
Dim rs As Recordset
Dim rs1 As Recordset
Set rs1 = "select * from tbl_wc_wcands_kpwcmatch"
Do While rs1.EOF = False
SQL = rs1!REC_ISN
Set rs = "select * from kpwcmaster,tbl_wc_wcands_kpwcmatch where
rec_isn = '" & SQL & "'"
If rs.EOF Then
DoCmd.RunSQL "insert into kpwcmaster select * from
tbl_wc_wcands_kpwcmatch where rec_isn='" & SQL & "'"
End If
rs1.MoveNext
Loop
End Sub
Thanks
Madhuri
Van T. Dinh - 13 Jul 2005 02:02 GMT
Check Access VB Help:
1. For DAO Recordset: the OpenRecordset Method.
2. For ADO Recordset: the Open Method of the Recordset Object or the Execute
Method of the Connection Object / Command Object.
There are plenty of sample codes in these Help topics (which should be your
first source of information).

Signature
HTH
Van T. Dinh
MVP (Access)
>I have to write a code where I have 2 tables table 1 and table 2 which are
> similar structures. I got to insert only those records which are not found
[quoted text clipped - 28 lines]
> Thanks
> Madhuri