List Box Questions

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

Guest

I have two list boxes on a form. Neither of them are bound to the forms
underlying query. Here is what I want to do.

The first list box contains a list of companies. The second list box is
initially empty. As I click on companies in the first list box, those
companies then populate the second list box. I have been able to get that
done. What I want to happen is this - after I click a company in the first
list box and it appears in the second list box, I want the company name in
the first list box to be removed so that it cannot be clicked again as long
as it is in the second list box. Any help would be appreciated.
 
Don,
If you 1st listbox is populated by a query, why not re-
write the query (say with DAO) with a where clause
eliminating the selected company. Then requery the list
box.
Geof.
 
Forgive my ignorance, but can you give me an example of how to do this. I am
not the most proficiant Access user there is.

Geof Wyght said:
Don,
If you 1st listbox is populated by a query, why not re-
write the query (say with DAO) with a where clause
eliminating the selected company. Then requery the list
box.
Geof.
 
Let's say your listbox had 2 columns; an id with column
width 0, and a companyname with non-zero column width. The
row source is a query: "Select id, companyname From
tblCompany Order by companyname". You could assign this
string to the rowsource property upon opening the form.

So you select a company name. In the listbox after update
event, you get the id (Me.listCompany.Column(0)). Re-
construct the query string to include the where clause.
"Select id, companyname From tblCompany Order by
companyname where id <> Me.listCompany.Column(0)". Then
Me.listCompany.Requery
and you might need
Me.Refresh

Geof.
-----Original Message-----
Forgive my ignorance, but can you give me an example of how to do this. I am
not the most proficiant Access user there is.
 
Back
Top