Solved

copy one recordset to another

Posted on 2001-06-07
6
132 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
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…
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…

705 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now