0

I have a simple database (made just for practice) with a number of tables. It's supposed to be a "Library usage database", with tables for books, lenders, cities etc.

For instance, the table "Lenders" is a table with..well.. people loaning books from the library. It has among other things a column "City" which is a Foreign Key (right?) that references to the table of Cities.

Now, I would like a form to add lenders. However, for "cities" I would like a control/ list box/ drop down box that displays the cities already entered (displayed by name). When I select a city in that list, the corresponding ID-number is set in the "Lenders" table.

Is there a (fairly) simple way to do this. I've experimented with subforms and list boxes, but not quite found a way to do this.

McWolfe
  • 188
  • 1
  • 7
  • Using a list box is the right way to solve this issue - so it would be useful to add some information what you've already tried. Especially since the in-detail solution depends on your table layout. – tohuwawohu Aug 03 '15 at 13:35
  • 1
    To populate the dropdown list: in the properties window for the listbox, on the tab "Data", the field "Type of list contents" should be "Sql" and the "List content" should be something like `SELECT "CityName", "CityID" FROM "CityTable" ORDER BY "CityName"`. The field "Data field" should be the column in the Lenders table in which to save the CityID. Does that help? – Lyrl Aug 03 '15 at 17:48
  • Actually, managed to solve it (with the help of a short youtube-video https://www.youtube.com/watch?v=XGWhHzyVXAA ). It used the wizard, but the end result looks like Lyrls reply above. I'm guessing I did some wrong setting in one place or another when doing it before. – McWolfe Aug 03 '15 at 22:33

0 Answers0