• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 418
  • Last Modified:

Dlookup

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
JackJackson54
Asked:
JackJackson54
  • 2
  • 2
1 Solution
 
Dale FyeCommented:

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
 
dqmqCommented:
>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
 
JackJackson54Author Commented:
The Jockey name changes from each row.
0
 
Dale FyeCommented:

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
 
JackJackson54Author Commented:
Thanks Fyed, the first one worked and worked great.  I have spent 2 hours trying to get mine to work
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now