Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

copy one recordset to another

Posted on 2001-06-07
6
Medium Priority
?
140 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

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 300 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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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.
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 process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses

610 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