Fill fields based on combo box selection

  • Thread starter Thread starter Kevin Sprinkel
  • Start date Start date
K

Kevin Sprinkel

To identify a steel type, I have a combo box cboSteelID,
which gets its values from tblSteelData, of the following
structure:

tblSteelData
SteelID AutoNumber
SteelType Number (FK)
Dimensions Text
LBperLF Single
SFperLF Single

On choosing a value for the combo box, I'd like to fill
two textboxes with the corresponding LBperLF and SFperLF
values to be used in calculations.

Can anyone tell me how?

Kevin Sprinkel
 
To identify a steel type, I have a combo box cboSteelID,
which gets its values from tblSteelData, of the following
structure:

tblSteelData
SteelID AutoNumber
SteelType Number (FK)
Dimensions Text
LBperLF Single
SFperLF Single

On choosing a value for the combo box, I'd like to fill
two textboxes with the corresponding LBperLF and SFperLF
values to be used in calculations.

Can anyone tell me how?

Kevin Sprinkel

Add 2 unbound controls to the form.
If the [LBperLF] and the [SFperLF] fields are included in the combo's
rowsource:

Code the AfterUpdate event of the combo box:
[ControlA] = Me.cboSteelID.Column(x)
[ControlB] = Me.cboSteelID.Column(x)

where (x) is the appropriate combo column number (Zero based).

If those fields are not included in the combo rowsource, then as
control source in the unbound control's, write:
=DLookUp("[ LBperLF ]","tblSteelData","[SteelID] = " & [cboSteelID])
=DLookUp("[ SFperLF ]","tblSteelData","[SteelID] = " & [cboSteelID])
 
Use a DLookUp (check the Help files for details) in the AfterUpdate event for the Combo

[txtLBperLF] = DLookUp("[LBperLF]","tblSteelData","[SteelID]=" & [cboSteelID]

Hope this helps

Howard Brod


----- Kevin Sprinkel wrote: ----

To identify a steel type, I have a combo box cboSteelID,
which gets its values from tblSteelData, of the following
structure

tblSteelDat
SteelID AutoNumbe
SteelType Number (FK
Dimensions Tex
LBperLF Singl
SFperLF Singl

On choosing a value for the combo box, I'd like to fill
two textboxes with the corresponding LBperLF and SFperLF
values to be used in calculations

Can anyone tell me how

Kevin Sprinke
 
Back
Top