Database DAO Question

Posted on 2003-03-13
Medium Priority
Last Modified: 2010-05-01
I have Table-1 in an access databse  that has two fields, lets call them, Field-A and Field-B, they both Contain a Integer value that corresponds to the Key firld in Table-2, lets say Table-2 has 2 fields Key-Field (ing) and Field-Name is there a way to write a OpenRecordset Line that would link them together and give me back 2 name.

example of why this is done.
Table 1
Field-A   Field-B
  1         2
  4         5
  2         6

Table 2
Field-Key Field-Name
1             BOB  
2             Mary
3             Craig
4             Dave
5             Jane
6             Suzanne

Result of SQL Call
Field-1     Field-2
BOB           Mary
Dave          Jane
Craig         Suzanne

Question by:MICS
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 44

Accepted Solution

Arthur_Wood earned 200 total points
ID: 8129802
Select A.Name, B.Name from Table1 AB , Table2 A, Table2 B
   where AB.Field1 = A.Key and AB.Field2 = B.Key



Expert Comment

ID: 8132377
Taking you quite literally on all your table and field names, this is required:

SELECT Table2.[Field-Name] AS [Field-1], Table2_1.[Field-Name] AS Field2
FROM ((Table1 INNER JOIN Table1 AS Table1_1 ON (Table1.[Field-B] = Table1_1.[Field-B]) AND (Table1.[Field-A] = Table1_1.[Field-A])) INNER JOIN Table2 ON Table1.[Field-A] = Table2.[Field-Key]) INNER JOIN Table2 AS Table2_1 ON Table1_1.[Field-B] = Table2_1.[Field-Key];

Expert Comment

ID: 9056362
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Post your closing recommendations!  No comment means you don't care.

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…
Suggested Courses
Course of the Month15 days, 6 hours left to enroll

743 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