- the first form contains information about an item (manufacturer, catalogue
no...)
- the second form is essentially a table of cost history of the item
(11/12/2005 - $2.00, 11/12/2006 - $5.50, 11/12/2007 - $5.00...); - it is
opened by a command button on the first form and filtered for records that
match the manufacturer and catalogue no.
- each new record for the table that is the second form's data source
requires the related fields for manufacturer, and catalogue no. (as well as
cost, date... which the user enters)
I want, on the second form, to be able to add additional records to the
table, and want to do so without the user having to enter the manufacturer
and catalogue no (it is always the same as on the first form, and should be
gotten automatically)
By far the simplest way to do this is to make the second form a
Subform of the first one, using the item's unique key - which might be
the Manufacturer and the Catalogue Number in conjunction - as the
subform's Master Link Field and Child Link Field. If you're short of
screen real estate, you can use a Tab Control and put the subform on a
tab page.
If you have a real need to use a separate form, you'll need some VBA
code. Open the form using a WhereCondition (rather than a filter)
selecting the manufacturer and catalogue number; and ALSO pass those
values (delimited appropriately) in the OpenArgs parameter of the
OpenForm method. Then in the second form's Open event set the
DefaultValue property of the controls to the values passed from the
first form.
John W. Vinson [MVP]