Read Table Data Into Form Fields

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a table with 4 columns. (1) Material Number, (2) Material, (3) Unit
of Measure, (4) Standard Cost. There are about 30 rows of data filled in.

I want to be able to enter a (1) material number and have the (2) material,
(3) unit of measure and (4) standard cost fill in on my form.

I will add invoice cost and favorability/unfavorability fields in the form,
but I am wondering how is the best way to do this. Thank you.
 
Presumably you have another table that contains the Material Number,
Material, Unit of Measure, and Standard Cost, and you you are now creating a
form where these values need to get entered into something like an order?

If so, you could use a combo box for Material Number, and set its RowSource
to the lookup table that contains all the values. I'm not sure the order
table should contain the Material column: would it be a problem if the
Material Number did not match the name in the Material column? If so, you
should not store this value in the order table as well. I'm guessing that
the other columns could be needed, e.g. if the material is normally measured
in litres, but you need to be able to fill out an order in grams.

If that's the idea, you could use the AfterUpdate event procedure of the
combo to assign the values from the secondary fields of the combo to the
other fields in the form. The code would look something like this:
Private Sub Material_Number_AfterUpdate()
With Me.[Material Number]
Me.[Unit of Measure] = .Column(2)
Me.[Standard Cost] = .Column(3)
End With
End Sub
 
Back
Top