Changing Query Criteria using List Box

N

nxqviet

Hi,

I have a question regarding ListBox and Append queries.

I want to be able to select an item in a listbox, and have a button
that when clicked, take the value of that selected item in the listbox
and enter it into a Criteria field of an Append Query.

Essentially , I want to Run this Append Query with a selected criteria
from the list box. This way, I will only append the seleted item(s) to
a new table.

Please advice, it is very important to me. Thanks


V-
 
G

Guest

Your use of the word "item(s)" suggests that you want multi-select capability
for your listbox. If this is true, you will need to ensure that the Multi
Select property is set to either Simple or Extended (as opposed to the
default None). You'll also need to use VBA code to iterate the .SelectedItems
property of your listbox. Before showing you an example of how to do that,
can you verify that you indeed do want multiselect capability?


Tom Wickerath
Microsoft Access MVP

http://www.access.qbuilt.com/html/expert_contributors.html
http://www.access.qbuilt.com/html/search.html
__________________________________________
 
N

nxqviet

Tom,

Ah, yes, I do have the Extended option on. So it is a multi Select
listbox.

Thank for the quick response,

V_
 
N

nxqviet

Tom,

I do want the listbox to have multiselect capacity. And does it matter
to have the listbox connectd to a table in stead of a query? the code
should be the same, except the name of the query inplace of the table,
right?

for my list box, I have it connected to a query, so that it displays
all items in this query.


Thanks Tom

V_
 
G

Guest

The Row Source for your listbox can be a table or a query.

I tell you what....instead of me trying to think up an example based on
Northwind, can you send me a zipped copy of your database as a starting
point? You can substitute any sensitive data with dummy data. My e-mail
address is available at the bottom of the contributors page indicated in the
link shown below. Please do not post your e-mail address (or mine) to a
newsgroup reply.


Tom Wickerath
Microsoft Access MVP

http://www.access.qbuilt.com/html/expert_contributors.html
http://www.access.qbuilt.com/html/search.html
__________________________________________
 
N

nxqviet

Tom,

I sent you the file, please take a look at it when you have some free
time. If you have not receive it, let me know, my fillter may block any
mdb file from being sent out.


V_
 

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