Solved

Fetching from 2 MSAccess Databases

Posted on 2002-04-28
6
161 Views
Last Modified: 2010-05-02
Hi expeees

i need to fetch records from tables from 2 different databases of MSACCESS, ex. I have Database1.mdb and Database2.mdb and both the databases have TBL1 table, i want to fetch all the records from both the databases to one recordset. Is it possible? your advice help to me a lot

Thanx in advance

0
Comment
Question by:vksharath
6 Comments
 
LVL 100

Expert Comment

by:mlmcc
Comment Utility
Yes it is possible.

Can you make changes to either database?  If so you could link the table from the other database to yours.

Are the records in the two database related in anyway or will the recordset be more of a union of the two?

good luck
mlmcc
0
 
LVL 2

Expert Comment

by:corvanderlinden
Comment Utility
I do not think it is possible with one select statement.
What about your primary keys? No conflict ?
0
 
LVL 43

Expert Comment

by:TimCottee
Comment Utility
It should be possible using this syntax:

"Select * From Tbl1 Union Select * From Tbl1 IN 'c:\MyFolder\MySecondDatabase.mdb'"

Assuming you have a valid connection to the first database.
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 5

Accepted Solution

by:
rkot2000 earned 100 total points
Comment Utility
I think TimCottee's solution is working only with dao.
link tables is better solution.


0
 
LVL 43

Expert Comment

by:TimCottee
Comment Utility
This solution works both with DAO and ADO rkot2000. Alternatively you could use a linked table or even a query which does it in access and then use the query as a table source in your VB application. Personally I would stick with the method I show.
0
 
LVL 43

Expert Comment

by:TimCottee
Comment Utility
Was that the right comment to accept? If so fine!
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

763 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

9 Experts available now in Live!

Get 1:1 Help Now