Run query based on table selected from a list box

G

Guest

I have a drop down box that lists all my tables. I want to create a command
button that will run a select statement on the table i select in my list
box. I'm using the select statment to filter out records that I don't want
(ie. Select * from Table1 where field1 > 1.) Is this possible? Or do I have
to create seperate queries for each table?
 
T

tina

I'm using the select statement to filter out records that I don't want

for what purpose or result? are you trying to populate a form? or just open
a query? if you want to actually open a query in datasheet view, AFAIK you
have to work with an actual query object. i think the closest you can get to
changing the table dynamically would be to use VBA to create a querydef and
open that; you might have to append the querydef to the queries collection
in order to open it, in which case you'd also need to delete it from the
collection afterward.

can you provide details of what you're trying to accomplish, rather than
just "how do i do this one thing"?

hth
 

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