Solved

copy one recordset to another

Posted on 2001-06-07
6
133 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…

911 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

17 Experts available now in Live!

Get 1:1 Help Now