?
Solved

Dlookup

Posted on 2011-09-25
5
Medium Priority
?
414 Views
Last Modified: 2012-05-12
I am using the below on Dlookup to no avaii:

JckRank:  dllookup([Rank], "JckRanks", "AthroughB.[Jockey] = "Ranks.[Jck]")

I am trying to get the ranks of a jockey from a table called JckRanks as below:

Jock           Rank
Smith            1
Gomez          2
Solis             3
Nakatani      4
Velasquez   5

In another Table named AthroughB, there is a column named Jockey.

In this query, I am trying to get the name of the jockey from  table AthroughB and get the rank of that jockey from table JckRanks.  For Example if the jockey name in the column named Jockey from table AthroughB is Nakatani, I want the query to get  the rank  of 4.  There are 1800 named jockeys.
0
Comment
Question by:JackJackson54
[X]
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
  • 2
  • 2
5 Comments
 
LVL 48

Accepted Solution

by:
Dale Fye earned 2000 total points
ID: 36595436

So, how about something like:

SELECT AthroughB.*, JckRanks.Rank
FROM AthroughB
LEFT JOIN JckRanks
ON AthroughB.Jockey = JckRanks.Jockey

Normally, I would use in autonumber (ID) field as the primary key of the AthroughB table and use that ID as the foreign key in my JckRanks table.  Trying to join on a name (I assume that [Jockey] field is a name) will be a problem with that many jockeys.
0
 
LVL 42

Expert Comment

by:dqmq
ID: 36595442
>I am trying to get the name of the jockey from  table AthroughB and get the rank of that jockey from table JckRanks.

dlookup only returns one value, not two.  For example, you can get a jockey's rank like this:


dlookup([Rank], "JckRanks", "[Jock] = ""Nakatani""")
0
 

Author Comment

by:JackJackson54
ID: 36595445
The Jockey name changes from each row.
0
 
LVL 48

Expert Comment

by:Dale Fye
ID: 36595499

If you don't like my query recommended above, you could try:

SELECT AthroughB.*, DLOOKUP("Rank", "JckRanks", "[Jock] = """ & AthroughB.[Jockey] & """") as JockRank
FROM AthroughB
0
 

Author Comment

by:JackJackson54
ID: 36595522
Thanks Fyed, the first one worked and worked great.  I have spent 2 hours trying to get mine to work
0

Featured Post

Get proactive database performance tuning online

At Percona’s web store you can order full Percona Database Performance Audit in minutes. Find out the health of your database, and how to improve it. Pay online with a credit card. Improve your database performance now!

Question has a verified solution.

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

This article describes a serious pitfall that can happen when deleting shapes using VBA.
New style of hardware planning for Microsoft Exchange server.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

771 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