Can a combo box selection chaange the values available in subseque

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I am trying to set up a Maintenance Log using access. I would like to create
a form which would have a combo box as the first field to be populated. This
combo box would have up to 12 different selectable names of pieces of
equipment. Depending on the selection here I would like to change the
selections available in the next combo box. IE Machine A would have
subsections D E and F annd Machine B would have subsections X Y and Z. The
fields would then be the same for the rest of the the form ie. Date Time and
a text description of the work carried out. How can I set up these combo
boxes for the first 2 boxes in this way and how can I make sure that the user
enters the value in the first box before they try and enter the value in the
second box which is dependant on the first.
 
Richard Connell said:
Hi,

I am trying to set up a Maintenance Log using access. I would like to create
a form which would have a combo box as the first field to be populated. This
combo box would have up to 12 different selectable names of pieces of
equipment. Depending on the selection here I would like to change the
selections available in the next combo box. IE Machine A would have
subsections D E and F annd Machine B would have subsections X Y and Z. The
fields would then be the same for the rest of the the form ie. Date Time and
a text description of the work carried out. How can I set up these combo
boxes for the first 2 boxes in this way and how can I make sure that the user
enters the value in the first box before they try and enter the value in the
second box which is dependant on the first.

The query for the second ComboBox needs to look something like...

SELECT ThisField, ThatField, etc... FROM SomeTable
WHERE SomeField = Forms!NameOfForm!NameOfFirstComboBox

You then need to issue a Requery on the second ComboBox in the AfterUpdate event
of the first one (and possibly in the Form's Current event so it will change as
you navigate in the form).

Solving problem one also solves problem two because if you try to make a
selection in the second ComboBox when the first one is still blank it will offer
no choices in its list.
 
Back
Top