Fill fields based on combo box selection

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
 
F

fredg

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])
 
H

Howard Brody

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top