Solved

copy one recordset to another

Posted on 2001-06-07
6
137 Views
Last Modified: 2010-05-02
Hello
I want to create a recordset from two similar tables that are in two different databases that have two different connections to them.

Is there a way to create a recordset from this two tables even if they are in two different connections?

or

must I create two recordsets and then join them in one?
If so what is the fastest way to join or copy a recordset to another?

Thanks
0
Comment
Question by:asimoes
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 19

Expert Comment

by:DreamMaster
ID: 6163299
Why would you want that if I can ask a stupid question here.... I mean...it doesn't matter how many recordsets you need...you can reference them so why join them into one? Sounds like wasted code to me...

Max.
0
 

Author Comment

by:asimoes
ID: 6163475
The problem DreamMaster is:
I need to populate a combobox with the records of this two tables.
Then if the user don't find the record he wants in this comboxbox, the program must add in one of the tables the new name he has just write in the combobox.

Did I made myself clear?

Thanks
0
 
LVL 43

Expert Comment

by:TimCottee
ID: 6163495
Which database are you using? In access this is simple, in SQL server it is not that difficult, other databases may be more difficult.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:asimoes
ID: 6163755
I'm using Access and one of the tables have about 2000 records.
I've tried already to open two connections for two recordsets and then use
---------------------
rs1.open sql1, cnn1
rs2.open sql2, cnn2
for i=1 to rs2.recordcount
  rs1.addnew
  rs1!field=rs2!field
  rs1.update
next i
---------------------
and it is too slow

Thanks
0
 
LVL 2

Expert Comment

by:damienm
ID: 6163822
I think you should use

while not rs2.eof

instead of rs2.recordcount

so that it does not have to count the number of records first.
0
 
LVL 43

Accepted Solution

by:
TimCottee earned 100 total points
ID: 6163829
Ok, if it is access then you can do the following:

sqlString = "Select * From MyTable Union Select * From MyTable1 In '\\server\share\folder\MyMDB.mdb'"
rs.Open sqlString,Connection

This will return a recordset combining the results from both tables.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question