Automatic fillin of fields

  • Thread starter Thread starter Leonard
  • Start date Start date
L

Leonard

I am wanting to choose an item in a single field and have
the other fields populated with the data associated with
this item from a table.

example:

Table
SKU#, Description, Price, Color

Form
I want to choose the SKU number and have the other fields
to "pop in"
 
Your table should only contain the SKU #. Storing the
additional data is unnecessary and bad programming. The
description, price and color should be stored in a
different table. On the form the additional fields can be
populated with the Dlookup function.

Jim
 
Jim/Chris said:
Your table should only contain the SKU #. Storing the
additional data is unnecessary and bad programming. The
description, price and color should be stored in a
different table. On the form the additional fields can be
populated with the Dlookup function.

I agree with this except for price. Since that can change it likely needs to be
stored with each record he is creating.
 
You need to have the form point to the table. Then you
can have each field in the form point to the appropriate
field in the table. This can be done in Record Source
under Data in the Properties screen of the form.

HTH,

John
 
Assuming your SKU field is a dropdown based on a query,
you can do the following:

- Select the other fields (description, price, color) in
the query that also selects the SKU (you do not need to
display them in the SKU dropdown - you can manage that
within the properties of the dropdown field);
- In the AfterUpdate event for your SKU field, add code
similar to this:
Me.DescriptionFieldName.Value = Me!SKUFieldName.Column(1)
[Note: the column property is zero-based, so your first
column = 0]
Me.PriceFieldName.Value = Me!SKUFieldName.Column(2)
Me.ColorFieldName.Value = Me!SKUFieldName.Column(3)

Hope that helps!
 
Back
Top