View Full Version : Automatic field entry on a form


jle
03-16-2000, 10:05 AM
Could someone please help me. I'm about to the end of my wits with this. I have two problems. First, I have a table called customers with two fields, Customer_ID and Customer_Name with Customer_ID being the primary key. On my form I have each field listed as a combo box and when I put in the Customer_ID, I want to automatically fill in the Customer_Name field and vice versa. Second, I have two tables, one called Plants, and one called Products (this is for a gravel pit). On my form each field is set up as a combo box and when I choose a Plant name, I want Products to be automatically filtered to show only those products associated with that Plant name. I would appreciate any help, for I have a high level of aggravation over this. Thanks a million.

FionaC
03-22-2000, 07:43 PM
The first part of your problem may be solved in a similar fashion to the second part of your problem. You'll probably have to put in a requery command in the After Update event procedure for both boxes.

As to the second part of your problem, I did something very similar that other day, except my form was a subform. I followed the step by step instructions in the sample solutions from MS. The only problem I found was since it was a subform, for the EditProducts query under CategoryID in the criteria row I had to add in the form name and the subform name eg [Forms]![FormName]![SubformName]![SelectCategoryFieldName]

The sample solution can be found C:\Program Files\Microsoft Office\Office\Samples\Solutions.mdb Click on "Work with combo boxes, list boxes, subforms & subreports" and in the example box click on "Limit the contents of one list based on the value selected in another". Just follow their example. (It's quite lengthy)