Populate combo-box

K

Kou Vang

I have a table that has multiple Site #'s and more than one year associated
to a site. So my table looks like this:

1001 1998
1001 2000
1002 1999
1002 2001
1002 2005

I have a form that I want to show one Site #, with a combo-box listing the
Years that are associated with the Site#. How can this bee done? I've been
trying for a good day, with no success. Thanks!
 
K

Kou Vang

I tried both of the ways, and was still unsuccessful? I know that there is a
simple solution, not just sure what it exactly is?
 
D

darkroomdevil

The examples in the link will work - but if you want something that is less
code ...

place your mouse curser in the row source property of the list box you want
to populate, a build button will uppear to the right. Click on it and create
your query that you want for the row source. In the query, Right click in
the the criteria row of the field you want to filter (which for you probably
means the year field is visible and the site # field is not visible but is
where you would enter the criteria). Select build from the drop down list -
navigate through the forms in the builder and find the field to filter on,
click paste and then OK.

Now instead of saving the query, close it and access will ask you if you want
to paste the sql for the queryy into the row source property - say yes or ok
or whatever ...

now all you need is .requery in code behind the form triggered from the
controls after update event. If you are not sure how to do that search fro
requery in the help file.

Kou said:
I tried both of the ways, and was still unsuccessful? I know that there is a
simple solution, not just sure what it exactly is?
Check this link how to filter a combo using another field in the form
[quoted text clipped - 12 lines]
 

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