Jody
The "lookup" column in tables can cause quite a bit of confusion for both
developers and users. The value that gets stored is the ID value of the
looked-up row, but the looked-up value is what is displayed. Imagine trying
to build a query that looks for, say, "Prince William Sound" when your table
holds "17"?!
The standard way of handling "looking ups" is to use forms, not tables. And
to convert that table "lookup column" back to a simple number field (or
whatever matches the ID field in the lookup table -- the table that holds
the values looked-up).
In a form, create a combobox control. For the row source of that combobox,
use a query. In that query, use the lookup table, and get the rowID and the
"looked-up value", in that order.
In the combobox control, set the Bound Column property to 1, and set the
Column Width property to something like "0,2" -- this hides the rowID and
displays the "looked-up value" in the combobox.
Make sure that combobox control refers to the field in your main table that
needs the ID.
Confused yet?!<g>
Regards
Jeff Boyce
Microsoft Office/Access MVP
Jody said:
If you go into the table and try to add a column, there is Insert, Lookup
(this is the one I used), delete and rename column.
I used the lookup column in the orders table so that the user would not
have
to type in the long, hard to spell chemical name. I am sure there is
probably
a better way to do this. Can you point me in that direction please?
:
Jody
What do you mean by "lookup column"? Is that something you are doing
directly in the table? If so, bear in mind that Access tables are great
places to store data, but are NOT great ways to display it ... that's
what
forms are for (and reports for printed display).
Regards
Jeff Boyce
Microsoft Office/Access MVP
Okay, they both work. THe first expresion returns the first price in
the
Chemicals table.
The second expresion also works for a set value.
I've checked all the names. Everything there looks good. The drop down
menu
in the form is set up as a lookup column in the orders table. Is that
wrong
to do? These chemical names are so long I am afraid that they will be
typed
in wrong, so I thought using the lookup column would be the easiest way
to
do
this. Could that be causing a problem?
:
I am trying to autofill a form based on a drop down menu. I want the
price
and description of an item to autofill. I have looked through all the
posting, tried them, and still cannot get the darn think to work. Here
is
what I have:
=DLookUp("[ContainerSize]","Chemicals","[ProductName] = ' " &
[ProductName]
& "'")
I am trying to look up the Price, in the Chemicals table, based on the
ProductName selected in the current form.
Any help would be appreciated.