Button to Run Form

G

Guest

I've got a fairly simple form setup that has a couple of graphs and a table
as outputs that are generated by queries in the background. At the moment the
queries run as soon as the form is opened, however I want the user to be able
to add a few inputs before running the form and, as such, would like the form
only to run when a button is pushed. How can I do this?

Thanks!
 
G

Guest

Thanks for getting back to me. I know how to use the click event on the
button but running the query doesn't refresh the graphs it feeds and also
this method doesn't stop the form from running the query automatically when
opened.
 
G

Guest

Yes. Basically there are a few inputs and then two graphs are the outputs. So
each time the form opens the graphs load, which requires running the queries
behind them. I want to set it up so that the graphs don't run until the user
clicks a button (or something similar) so they have a chance to enter the
inputs before waiting for the queries.
 
G

Guest

Here is how I think I might do it.
Make the chart object's visible property No in design view.
Remove the rowsource property form the chart.

Now when you open the form, the query will not run, because the chart has no
row source.
In the button's click event, assign the row source to the chart object and
make it visible.
 
G

Guest

Forgive me but I'm a bit of an amateur at this. I know how to select the
chart's rowsource but how do you then reassign it to the chart through the
button?

Thanks again.
 
G

Guest

You can put a line of code in the after update event of the button to assign
the row source. For starters, copy the text in the row source property and
use it in your code. It would be something like:

Me.SomeControl.RowSource = "SELECT ...."
 

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