DLookup Problem

G

Guest

Hi,
I'm having trouble with this dlookup- I need to bring up a value for the
name of the category rather than its ID. The ID field is a foreign key in
another table and is a combo box , row source EMP Query. Every combination I
try results in an error or a parameter box being put up.
=dlookup("BandName", "Bands", "BandID=" & dlookup("BandID", "Members",
"MemberID=" & MemberID))
Any help would be greatly appreciated, thank you in advance-
 
D

Duane Hookom

Is MemberID a field in your report?
Is MemberID numeric or text?
Is BandID numeric or text?
What is the "parameter box" asking for?
 
G

Guest

Member ID is a field in my report, and it is a number. Band ID is a number,
too. The parameter box is asking for a value for the band ID- if I don't put
anything, then it just brings up the members of each band without the name on
the report. I'd like for it to look like this:
Band Name: The Next Best Thing
Izak
Skiid
Oatz
Ben
It's giving me- Band Name: 1
Izak, etc.
Any clue to what's going on? I can't figure out if the lookup field on
BandID is what's throwing me off.
 
D

Duane Hookom

Come back with some table structures and correct field names. Don't state
"Band ID" or "Member ID" when your field names are actually "BandID" and
"MemberID".
 
G

Guest

My tables are set up like this:
Bands: BandID, BandName, Location, Phone
Members: MemberID, BandID (combo box), FirstName, LastName, Phone, Yield
MemberID and BandID are Autonumber fields in their respective tables, and
Number fields in the foreign tables.
There is a one to many relationship between BandID and MemberID.
The EMP Query is based on BandID and BandName to populate the combo box.
On the report, The BandID field will only return its numeric value, instead
of the BandName value that it returns on forms or in the tables.
I'm just assuming that a dlookup is the solution here, since I can't get
anything else to work, but the one I posted first isn't working. Any thoughts
 
G

Guest

I found a solution that would work after stepping away from it for a while- I
just added the BandName field to the query and left theBandID field out of
the report. Works fine. I'm terribly sorry for all the row- You're good
people to be so patient. Thanks a lot and keep up the good work- Although I
am curious to know why you can't use the combo box or list box in the
report.... Aaron Regular
 

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

Similar Threads

dlookup error 2001 1
DlookUp Syntax problem 12
Dlookup( One more thing... 2
dlookup problem 9
DLookUp for Memo field 1
DLookUp syntax 9
Combo box question on a form 3
DLookup problems 7

Top