Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / July 2005

Tip: Looking for answers? Try searching our database.

How to open recordset

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Madhuri - 13 Jul 2005 00:21 GMT
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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.