Help connecting info in combo boxes

  • Thread starter Thread starter jbennett
  • Start date Start date
J

jbennett

i'm new to access and i'm creating a form and i want to make one combo box
show information pretaining to the selection in the other combo box. here is
how it works i have table A and table B the fields are:
table A:
flocno-location number primary key autonumber
flocname-name of location

table B:
fstandno-stand number primary key autonumber
flocno-number that tells which location the stand is at
fstandname-name of the stand

now i have a form where they select the location then the stand and it gets
put into a record keeping table. what i want is when a location is selected
in combo box A that only the stands that have the matching flocno show in
combo box B. does this make sense? if anyone can help that would be great. if
you need anymore info please let me know.

thank you
 
These are commonly known as "cascading combos". The easiest method is to
use a reference to your first combo as a selection criterion for the
rowsource query of the second combo.

In your case, the rowsource of the second combo should be something like
this:

Select [fstandno], [fstandname] from [table B]
where [flocno]=Forms![YourFormName]![Combo1Name]
order by [fstandname];

When the value selected in the first combo box changes, you will need to
requery the second combo to refresh the list:
Me.[Combo2Name].Requery

You should do this is Combo1's AfterUpdate event and also in your form's
Current event.
 
Thank you very much. that worked great.

In your case, the rowsource of the second combo should be something like
this:

Select [fstandno], [fstandname] from [table B]
where [flocno]=Forms![YourFormName]![Combo1Name]
order by [fstandname];

When the value selected in the first combo box changes, you will need to
requery the second combo to refresh the list:
Me.[Combo2Name].Requery

You should do this is Combo1's AfterUpdate event and also in your form's
Current event.
i'm new to access and i'm creating a form and i want to make one combo box
show information pretaining to the selection in the other combo box. here
[quoted text clipped - 19 lines]
thank you
 
Back
Top