Solved

working with 2 datafiles

Posted on 2002-07-12
4
170 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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

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…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…

746 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

11 Experts available now in Live!

Get 1:1 Help Now