Solved

working with 2 datafiles

Posted on 2002-07-12
4
172 Views
Last Modified: 2010-05-03
in my application i need to get a query that join 2 tables from 2 different datafiles,
i have main.mdb that i use to store employees data
and common.mdb that has list and values
i fill the caode in data.mdb tables but the code and  description is in common.mdb
now i want to show on a datagrid, one of the tables from main.mdb, but i want to display the code and description
the code is in main.mdb and description is in common.mdb ?
how can i do that ?
Does attaching the tables from common.mdb to data.mdb solve the problem or any other better answer ?????????
i use MS Access 2000 and VB6.0 on Win98SE
note that : the main.mdb and common.mdb could be installed to different locations, and location of common.mdb could change any time.

0
Comment
Question by:raed
4 Comments
 
LVL 43

Accepted Solution

by:
TimCottee earned 50 total points
ID: 7149026
You have two choices, you can either create linked tables in main.mdb to the real tables in common.mdb and treat them as if they were always in main (access handles updating, selecting etc). Or you can use the IN clause to specify an alternate mdb to retrieve data from:

Select MainTable.*,CommonTable.* From Main Inner Join Common IN 'c:\myfolder\common.mdb' On MainTable.Key = CommonTable.Key

However you need to know where common.mdb is at all times, this could be stored in the registry or some other place where you can retrieve the current location when required so your statement would become:

"Select MainTable.*,CommonTable.* From Main Inner Join Common IN '" & strCommonMDBPath & "' On MainTable.Key = CommonTable.Key

Where strCommonMDBPath contains the full path and filename of the common mdb.
0
 

Author Comment

by:raed
ID: 7152024
which is better , i think i m using the first way now but i wanted to be sure,
i need always to reattach the linked tables , i used reattach procedure it worked on Access97 but on 2000 it give lot of problem, is ther a good reattachment function any where i can use,,, for MS Access 2000 ?

thanx alot
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 8002368
Hi raed,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept TimCottee's comment(s) as an answer.

raed, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
0
 

Expert Comment

by:SpideyMod
ID: 8095359
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
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…
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…
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…

776 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