Show query results in form

K

KRR

So I have a combo box listing all the queries in my database. When I choose a
query and click my [Run Query] button I'd like the query to display within a
sub form I have below the combo box.

I have it working right now writting the query results to a list box in my
sub form but I can't edit any of the data.

What I'd like is the full query view to show within my sub form so I can
edit/sort etc.

Thanks,
Ken
 
J

John W. Vinson

So I have a combo box listing all the queries in my database. When I choose a
query and click my [Run Query] button I'd like the query to display within a
sub form I have below the combo box.

I have it working right now writting the query results to a list box in my
sub form but I can't edit any of the data.

What I'd like is the full query view to show within my sub form so I can
edit/sort etc.

Thanks,
Ken

Set the Form's Recordsource property to the name of the query in the
AfterUpdate event of the combo box.

Note that only Select queries (not action queries, such as update or
make-table queries) return records, and that some of your queries may require
parameters (which might or might not be available).

This seems like a VERY VERY strange thing to do.
 
K

KRR

Thanks John but I don't understand how this will work. I can set the record
source easy enough but how do I get the the form to show anything when it
doesn't have any fields defined on the form?

The reason I want to do this is to allow my users to have access to the back
end end data for data-cleaning purposes without having to give then access to
the database window.

---Ken

John W. Vinson said:
So I have a combo box listing all the queries in my database. When I choose a
query and click my [Run Query] button I'd like the query to display within a
sub form I have below the combo box.

I have it working right now writting the query results to a list box in my
sub form but I can't edit any of the data.

What I'd like is the full query view to show within my sub form so I can
edit/sort etc.

Thanks,
Ken

Set the Form's Recordsource property to the name of the query in the
AfterUpdate event of the combo box.

Note that only Select queries (not action queries, such as update or
make-table queries) return records, and that some of your queries may require
parameters (which might or might not be available).

This seems like a VERY VERY strange thing to do.
 
J

John W. Vinson

Thanks John but I don't understand how this will work. I can set the record
source easy enough but how do I get the the form to show anything when it
doesn't have any fields defined on the form?

Oh... sorry... should have said. A Datasheet form would be the only practical
option if you can't define the query's structure ahead of time.
 
K

KRR

But when switching from query to query do I not need a way to clear the form
of all previous fields and recreate the fields for the new query so they'll
show up in datasheet view?

Thanks,
Ken
 
J

John W. Vinson

But when switching from query to query do I not need a way to clear the form
of all previous fields and recreate the fields for the new query so they'll
show up in datasheet view?

Ummmm...

did you try it?
 

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