tags:

views:

79

answers:

3

I have a linked table in ms-access that pulls data from a mysql database. In it is a field titled 'job' that should have three possible values, 'Chairperson', 'Vice-Chair' and NULL. I have a local table I have titled jobs that has two columns, title and value.

title|value
Chairperson|Chairperson
Vice-Chair|Vice-Chair
Member|NULL

It looks like setting a lookup box display control in the design view of the linked table to should provide a solution but I cannot seem to be able to set the rows in the title field as what shows up in the dropdown and the corresponding value in the values table to be what the field is set to. Am I missing something? a translate command or something?

A: 

On the lookup tab do the following:

  • Set the rowsource as a query containing the two columns value, title (in that order)
  • Set the bound column to 1
  • Set the column count to 2
  • Set the column widths to 0;2" (change the 2" to whatever you need for the width of the display column)
  • Set "limit To list to" yes
JohnFx
A: 

It is not recommended to use look-up fields in tables:

The Evils of Lookup Fields in Tables

Use a query to display information and a form for data entry.

Remou
Well, it's not recommended by one or two MVP's. I think it would be better to say that they should be used carefully.
le dorfier
I have been reading problems with Access for a number of years, and look-up fields in tables cause quite a bit of grief. Avoiding them is easy enough. If the OP needs to create a report or query, the look-up fields will immediately become a problem.
Remou
They should not be used at all in TABLES. They are great in all other datasheets (forms/queries).
David-W-Fenton
I am a bit shocked to see an MS MVP make such dubious claims as some of those on the page you linked to. 2,4,5 and 7 on that list look flat out wrong and #3 presupposes that you wouldn't normally have a "relationship" or indexes on a lookup table. Just silly.
JohnFx
"They should not be used at all in TABLES." -- Moot point: tables are ACE/Jet objects, whereas lookup fields are an Access 'feature'. If you know how to put a lookup field into a table then post the ACE/Jet syntax SQL DDL ;-)
onedaywhen
That is 'feature' spelled 'anti-feature' :)
Remou
+1  A: 

In addition to JohnFx's implementation of showing the data, you want to fix the underlying table structure. Set up your table to look like this:

id (autonumber)    title
-------------------------
1                  Chairperson
2                  Vice-chair

Store the ID of the title in the linked table as opposed to the text of the Title field, and make it a Foreign Key. Also, don't add a record for NULL, as the principle of a Foreign Key field states that the value must exist in the table where it is a Primary Key, or it must be null.

HardCode