List Box Display when using a query as a data source

R

Ross

The value of one of my columns in the list box displays the number of the
prime key column and not the field value required as shown in the query. This
appears to be caused when I query a table which uses a lookup field.
Any Ideas how to get round this one?
 
T

Tom Wickerath

Hi Ross,

Yeah, get rid of the lookup field at the table level. These are the creation
of the evil one. See the 2nd Commandment here:

http://www.mvps.org/access/tencommandments.htm


Tom

http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________

:

The value of one of my columns in the list box displays the number of the
prime key column and not the field value required as shown in the query. This
appears to be caused when I query a table which uses a lookup field.
Any Ideas how to get round this one?
 
D

Douglas J. Steele

Well, to be honest getting rid of the lookup field won't solve the problem:
it'll just make it a little more obvious what's going on.

Ross: I agree with Tom that you shouldn't use Lookup fields in tables.
However, whether you remove the lookup field or not, what you need to do is
create a query that joins your main table to the table that contains the
text details for that particular field, and then use that query as the row
source for your listbox.
 
R

Ross

Cheers Douglas

Cracked it
Do you know of an alternative to the Lookup Field as it is important to the
format of the field value?

Ross
 
J

John W. Vinson/MVP

Do you know of an alternative to the Lookup Field as it is important to
the
format of the field value?

The main benefit of the Lookup field is that it lets you use table datasheet
view more easily, displaying the related fields.

The best solution is to... not use the table datasheet. It's best reserved
for debugging and for quick & dirty searches. Data display and editing are
better done on Forms, and you can easily put Combo Boxes on forms, with or
without using the Lookup Wizard. Your experience is a good example of why
most developers consider the Lookup to be poorly implemented: what you see
isn't what's actually in the table.

John W. Vinson
 
R

Ross

Cheers John
Understand that - Thanks
Ross

John W. Vinson/MVP said:
The main benefit of the Lookup field is that it lets you use table datasheet
view more easily, displaying the related fields.

The best solution is to... not use the table datasheet. It's best reserved
for debugging and for quick & dirty searches. Data display and editing are
better done on Forms, and you can easily put Combo Boxes on forms, with or
without using the Lookup Wizard. Your experience is a good example of why
most developers consider the Lookup to be poorly implemented: what you see
isn't what's actually in the table.

John W. Vinson
 
T

Tom Wickerath

Hi Ross,

You're welcome. I recommend making the entire site
(http://www.mvps.org/access/) a part of your night-time reading! There's
lots of good information at this site.

I was probably a bit too "quick-on-the-draw" with my first answer. Since you
implicated lookup fields as the possible culprit, I didn't spend any real
time analyzing the situation in more depth, like Doug Steele did. Bad Tom.

Tom

http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________

:

Thanks for the link Tom
It'll make good night time reading,
Cheers Ross
 
Top