Solved

working with 2 datafiles

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…
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…

948 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

19 Experts available now in Live!

Get 1:1 Help Now