Filtering Source for Combo Box

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

Kevin Sprinkel

A table named tblSteelData is being used as the source for
a combo box in a multiple record subform.

tblSteelData
=============
SteelTypeID AutoNumber
Type N, FK
Dimensions T
LBPerLF N
SFPerLF N

The Type and Dimensions identify the cross-sectional shape
and size, respectively. Rather than show all records, I'd
like the user to input the type from one combo box, and
display the dimensions for the tblSteelData records of
that type in a second combo box. Once the dimensions are
selected, I want to store the SteelTypeID associated with
these two field values in the underlying table.

If this "split" combo box is possible, I'd appreciate any
help implementing, including how to filter the records for
the second combo box.

Thanks for all assistance.

Kevin Sprinkel
 
Hi,



Change the RowSource appropriately, something like (in the gotFocus
event, as example):


Dim str As String

str="SELECT SteelTypeID, Type, Dimensions, LBPerLF, SFPerLF FROM
tblSteelData "
str=str & " WHERE TRUE ""
str=str & ( " AND Type=" + Me.Type )

' Debug.Print str

If Me.ComboBoxName.RowSource <> str then
Me.ComboBoxName.RowSource=str
End If



Hoping it may help,
Vanderghast, Access MVP
 
Back
Top