I have 2 tables and to enter data, I am designing a form. I have created a
relationship, and need that when entering data, I should see all the
available selections to choose from. How to put this kind of lookup in a
form? [A book said when you create a form based on relationships, a subform
automatically appears, but not in my case]. Please help. Thanks
There are several typs of Lookups you can use: Combobox, Listbox, or Subform. If you need to choose from a list of
selections and choose only ONE of those items, then a combo or listbox would be the better choice. If you need more than
one a subform is the easiest method.
If you use the combo/listbox method, then you'd add the control to your form and set the .ControlSource to the field
where you want to store the user's selection. Next you'd set the RowSource to show the data you wish the user to select
from. Note that typically the FIRST column in your RowSource is the one that will be stored in your table.
You can hide a column in your combo/listbox by setting the .ColumnWidths property; a value of 0 will hide a column, so
if you have 3 columns and wish to hide the first, you'd do something like this: 0;1;1.
If your user can choose more than one selection, then a subform would be in order. In this case, your subform would be
based on whatever table you're using to store the user's choices (since this would be a 1-Many relationship, you
couldn't store them in the main table), and you'd probably want to show the form in Continuous or Datasheet view.
I believe you may have misread the section of the book; Access won't automatically create subforms based on
relationships. If you embed a form into a mainform, and that subform is based on a table which is correctly related to
the mainform's table, then Access will usually create the Master/Child links to correctly relate the two forms.
Scott McDaniel
scott@takemeout_infotrakker.com
www.infotrakker.com