Solved

Dlookup

Posted on 2011-09-25
5
406 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
  • 2
  • 2
5 Comments
 
LVL 47

Accepted Solution

by:
Dale Fye (Access MVP) earned 500 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 47

Expert Comment

by:Dale Fye (Access MVP)
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

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

Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
Microsoft Office Picture Manager was included in Office 2003, 2007, and 2010, but not in Office 2013. Users had hopes that it would be in Office 2016/Office 365, but it is not. Fortunately, the same zero-cost technique that works to install it with …
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

920 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

15 Experts available now in Live!

Get 1:1 Help Now