Solved

copy one recordset to another

Posted on 2001-06-07
6
136 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
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!

 

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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

739 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