Solved

working with 2 datafiles

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

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…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…

735 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