Code a button to display line items of table that appear more then

B

BZeyger

Hello,

I have a table (Main_table) that has 3 columns. The three columns are Part,
Name, and Location.
I also have a form that has 3 list boxes (lstPart, lstName, and
lstLocation), and a button. I would like the user to click the button and the
list boxs would populate with all items that appear more than 15 times in the
table. lstPart would show all of the line items that appear 15 or more times
in the category.

I am a little confused on how to code this. Can someone provide assistance?
 
J

John W. Vinson

Hello,

I have a table (Main_table) that has 3 columns. The three columns are Part,
Name, and Location.
I also have a form that has 3 list boxes (lstPart, lstName, and
lstLocation), and a button. I would like the user to click the button and the
list boxs would populate with all items that appear more than 15 times in the
table. lstPart would show all of the line items that appear 15 or more times
in the category.

I am a little confused on how to code this. Can someone provide assistance?

You could set the RowSource of lstPart to a Query:

SELECT Main_table.Part FROM Main_table
GROUP BY Part
HAVING Count(*) >= 15
ORDER BY Part;

and similarly for the other listboxes. It's not clear if you want this to be a
permanent setting or something that toggles from >= 15 to <I don't know what
else> in response to the button, but you could use the Click event of the
button to assign the above SQL string to the listbox's RowSource.
 

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