Solved

Accessing Two mdb files

Posted on 2000-03-13
5
228 Views
Last Modified: 2008-02-01
Hi,
    Can i get  infomations from diffrent .mdb files to fill to a form.  For example, i want to takes informations from table A  where the contents have same value as those from table B. Both tables must  from DIFFRENT mdb files.
 
0
Comment
Question by:thg
5 Comments
 
LVL 2

Expert Comment

by:johnny6
ID: 2614681
thg:
    Open both databases and both tables and perform an inner join on them.  If you need help on how to do this let me know.


John
0
 
LVL 2

Expert Comment

by:idorey
ID: 2614754
Erm..

Perhaps you could just open both databse files and access them??

Seems that you dont really need anything else, just to open and access 2 mdb files at the same time.
0
 
LVL 1

Expert Comment

by:alfaromeo
ID: 2614756
Have u used data controls? This is the easiest way to do it.

1. Create 2 data controls  - associate one with each database(table or SQL query)

2. Use an ADO Data control on the form

3. Associate each form control with the respective data control.

Bingo!

0
 
LVL 1

Expert Comment

by:avitalk
ID: 2615224
how about creating a table link in one database to the other.

that way you can do a query that uses both tables.

Avital
0
 
LVL 43

Accepted Solution

by:
TimCottee earned 60 total points
ID: 2615298
Use the IN Clause in your select statement:

Create a connection to db A, using ADO this might be:

Dim cnnMDBA As ADODB.Connection
Dim rstSelect As ADODB.Recordset
Set cnnMDBA = New ADODB.Connection
Set rstSelect As New ADODB.Recordset
cnnMDBA.ConnectionString = "Provider=....;Data Source = <DatabaseA.MDB>"
cnnMDBA.Open
rstSelect.Open "SELECT A.Name,A.Number,B.Name,B.Number FROM <TableA> A,<TableB> In '<DatabaseB.MDB>' B Where A.Number = B.Number",cnnMDBA,adOpenStatic,adOpenLockOptimistic
0

Featured Post

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

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
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…

760 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