Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Database DAO Question

Posted on 2003-03-13
3
Medium Priority
?
133 Views
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


Thanks,
0
Comment
Question by:MICS
3 Comments
 
LVL 44

Accepted Solution

by:
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

AW

0
 
LVL 3

Expert Comment

by:QJohnson
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];
0
 

Expert Comment

by:CleanupPing
ID: 9056362
MICS:
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 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
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 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…
Suggested Courses

564 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