Hopefully only take you a monent....

  • Thread starter Thread starter Trish
  • Start date Start date
T

Trish

Hello,
I am a bit of a novice on Access and because of this
can't find the help I need.
I want to have two combo boxes in a table, where the
options in box 'B' depend on the selection in box 'A'.

I have tried all sorts of things but am hoping it is much
simpler than I think!!

Please help,

Desperate of Nottingham
 
The standard approach is to compose the RowSource SQL for
comboB in either its GotFocus eventHandler or the
AfterUpdate eventhandler of comboA. If it is the value of
comboA that you wish to use, the code would usually be
along the lines of
comboB.RowSource = "SELECT .... FROM ... WHERE colX = " &
comboA.Value
if the comboA value is numeric or
comboB.RowSource = "SELECT .... FROM ... WHERE colX = '" &
comboA.Value & "'"
for an alphanumeric

Hope This Helps
Gerald Stanley MCSD
 
Trish said:
Hello,
I am a bit of a novice on Access and because of this
can't find the help I need.
I want to have two combo boxes in a table, where the
options in box 'B' depend on the selection in box 'A'.

I have tried all sorts of things but am hoping it is much
simpler than I think!!

Forget about doing this "in the table". While Access allows this it is a
bad idea. Create a form for data entry and put your ComboBoxes on the
form. The second ComboBox will use a query for its RowSource and that
query can point back to the form and use the first ComboBox value as a
selection criteria. It would look something like...

SELECT SomeField FROM SomeTable
WHERE SomeOtherField = Forms!FormName!FirstComboBox

You will need code in the AfterUpdate event of the first ComboBox and in
the Current event of the Form that requeries the second ComboBox.
 
Back
Top