Text Box Question

Barbara Sherman

New member
Local time
Today, 16:42
Joined
Jan 27, 2003
Messages
7
I have a form with 3 combo boxes, each linked to the other.

Combo Box 1 - We select a manufacturer.
Combo Box 2 - We select a model (models shown are only those of the manufacturer selected).
Combo Box 3 - We select a color (colors shown are only colors available for the model selected).

I need the text box to show the freight amount.

There are 2 tables involved. tblFreight & tblModels

tblModels contains a FreightCode. tblFreight also contains the FreightCode. There are multiple FreightCodes.

The text box should match the freight code in tblModels to the freight code in tblFreight and put the amount shown in the FreightActual column for that freight code in the text box.

I have been working on this for 2 days now and cannot get it to work. Any help is greatly appreciated.
 
This code may work for what you need to do:

Dim stFreightCode as String

stFreightCode = DLookup ("[FreightCode]","tblModels","[Model]=me.ComboBox2")
TextBox = Dlookup ("[FreightCode]","tblFreight","[FreightCode]=stFreightCode")

In the first line, [FreightCode] is the field name from the tblModels that contains the freight code. [Model] is the field name for the model in the table. ComboBox2 should be the name of the combo box where you select a model.

On the second line [FreightCode] is the field name from the tblFreight. TextBox is the name of your textbox where you want this information displayed.

Put this in the AfterUpdate event of Combo Box 2.

HTH
 

Users who are viewing this thread

Back
Top Bottom