DLookup Expression trouble

P

Pamela

I have a DLookup expression in my query that I want to return the
corresponding description (text) for a given ID (Autonumber, pk) in the
query. My expression isn't returning the different values but rather for
each one, regardless of the ID, it's returning the description that
corresponds to ID #1 only. Please help me see what I'm missing. Here's my
expression:
DLookUp("[Parts]","[ltblParts]","[ID]=" & "[ltblParts.ID]")
Thanks so much!

Pamela
 
G

Gina Whipp

Pamela,

If numeric...

=DLookup("Parts", "tblParts", "[ID]=" & Me![ID])

If text...

=DLookup("Parts", "tblParts", "[ID]='" & Me![ID] & "'")


Also, confirm the name of your tblParts because you have ltblParts.

--
Gina Whipp
2010 Microsoft MVP (Access)

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm
 
P

Pamela

Hi Gina,

I realized right after I posted that I mistakenly posted this in Forms and
not Queries. But since reposting is so frowned upon, I didn't want to repost
even into Queries. This is an expression in my query so the Me![ID] format
doesn't work. At this point, do you want to me repost into Queries, as it
should be, or continue here to try to get help? And yes, ltblParts is
correct. I have added the "L" to the beginning to signify that it is just a
lookup table for my own ease but sorry to confuse.

Thanks!

Gina Whipp said:
Pamela,

If numeric...

=DLookup("Parts", "tblParts", "[ID]=" & Me![ID])

If text...

=DLookup("Parts", "tblParts", "[ID]='" & Me![ID] & "'")


Also, confirm the name of your tblParts because you have ltblParts.

--
Gina Whipp
2010 Microsoft MVP (Access)

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

Pamela said:
I have a DLookup expression in my query that I want to return the
corresponding description (text) for a given ID (Autonumber, pk) in the
query. My expression isn't returning the different values but rather for
each one, regardless of the ID, it's returning the description that
corresponds to ID #1 only. Please help me see what I'm missing. Here's
my
expression:
DLookUp("[Parts]","[ltblParts]","[ID]=" & "[ltblParts.ID]")
Thanks so much!

Pamela


.
 
P

Pamela

Nevermind, I found a solution. Thanks!

Pamela said:
Hi Gina,

I realized right after I posted that I mistakenly posted this in Forms and
not Queries. But since reposting is so frowned upon, I didn't want to repost
even into Queries. This is an expression in my query so the Me![ID] format
doesn't work. At this point, do you want to me repost into Queries, as it
should be, or continue here to try to get help? And yes, ltblParts is
correct. I have added the "L" to the beginning to signify that it is just a
lookup table for my own ease but sorry to confuse.

Thanks!

Gina Whipp said:
Pamela,

If numeric...

=DLookup("Parts", "tblParts", "[ID]=" & Me![ID])

If text...

=DLookup("Parts", "tblParts", "[ID]='" & Me![ID] & "'")


Also, confirm the name of your tblParts because you have ltblParts.

--
Gina Whipp
2010 Microsoft MVP (Access)

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

Pamela said:
I have a DLookup expression in my query that I want to return the
corresponding description (text) for a given ID (Autonumber, pk) in the
query. My expression isn't returning the different values but rather for
each one, regardless of the ID, it's returning the description that
corresponds to ID #1 only. Please help me see what I'm missing. Here's
my
expression:
DLookUp("[Parts]","[ltblParts]","[ID]=" & "[ltblParts.ID]")
Thanks so much!

Pamela


.
 
G

Gina Whipp

Pamela,

One... glad you got it! For future refrence when you want to *also* post to
another section just put a comma and type the section, ie...

,microsoft.public.access.queries

and it will cross post so it will show up in both forums.

Two, can you post your solution so other can benefit?

--
Gina Whipp
2010 Microsoft MVP (Access)

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

Pamela said:
Nevermind, I found a solution. Thanks!

Pamela said:
Hi Gina,

I realized right after I posted that I mistakenly posted this in Forms
and
not Queries. But since reposting is so frowned upon, I didn't want to
repost
even into Queries. This is an expression in my query so the Me![ID]
format
doesn't work. At this point, do you want to me repost into Queries, as
it
should be, or continue here to try to get help? And yes, ltblParts is
correct. I have added the "L" to the beginning to signify that it is just
a
lookup table for my own ease but sorry to confuse.

Thanks!

Gina Whipp said:
Pamela,

If numeric...

=DLookup("Parts", "tblParts", "[ID]=" & Me![ID])

If text...

=DLookup("Parts", "tblParts", "[ID]='" & Me![ID] & "'")


Also, confirm the name of your tblParts because you have ltblParts.

--
Gina Whipp
2010 Microsoft MVP (Access)

"I feel I have been denied critical, need to know, information!" -
Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

I have a DLookup expression in my query that I want to return the
corresponding description (text) for a given ID (Autonumber, pk) in
the
query. My expression isn't returning the different values but rather
for
each one, regardless of the ID, it's returning the description that
corresponds to ID #1 only. Please help me see what I'm missing.
Here's
my
expression:
DLookUp("[Parts]","[ltblParts]","[ID]=" & "[ltblParts.ID]")
Thanks so much!

Pamela


.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top