简体   繁体   中英

In MS-Access, how to display the old foreign key in a combo box when the foreign key no longer exists?

I have a combobox with two columns. The first column is hidden. The second is not hidden. The first column is the bound column. The second is the display text.

ColumnCount = 1
ColumnWidths = 0";1"
RowSource = "a select statement"
BoundColumn = 1

For example:

SKU       | Description
"teapot"  | "Pretty Teapots"
"saucer"  | "Excellent Saucers"
"tallcup" | "Tall Cups"

The user sees the second column in the combo box. Everything works. If the user chooses "Tall Cups", then "tallcup" is stored in the underlying table.

Later.... The value "tallcup" is removed from the list on purpose. What I now want is for the user to see "tallcup" in the Combo Box for those records where it was originally set. But for new records, "tallcup" is not an option.

What it currently shows is blank. It's as if nothing was ever selected.

Do I need to do something with the format property?

Here are some related links that I found around the internet, but they didn't help me much:

http://www.tutcity.com/access/display-the-corresponding-unbound-column-entry-of-a-combobox.79599.html

https://www.google.com/search?q=ms-access+2+column+show+first+combobox+missing+show+anyway&rls=com.microsoft%3Aen-us%3AIE-SearchBox&oe=&gws_rd=ssl&oq=&gs_l=

http://www.experts-exchange.com/Database/MS_Access/A_5890-Adding-the-option-all-to-a-ComboBox.html

Add a third coloumn with an Active flag. Set it to False for tallcup and add an beforeupdate event setting Cancel to Not Active and pop a message if so.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM