Running a query off a form

B

Bob Quintal

Barkley said:
Hi...

I was wondering if someone could walk me through the procedure for
running a query off a form... I have been going through the search
engine and have posted a couple threads as I have been hunting and
pecking for information that pertain to what I am doing but am
still coming up empty-handed...

I think once I have the basics down I can go from there on my
own...

In its most basicsense, this is what I am trying to do...

I want a form with a command button that will run a query... the
query doesnt have to appear as anything special, just a plain old
select query showing tabular results... so when I open the form
and click the button, the query will run... can someone please
tell me how to do that... I know it probably sounds incredibly
basic, but for the life of me, I can't find the information I
require to cover whatever steps are needed to do that... any
thoughts would be appreciated...

Thanks, Barkley
Just put Docmd.openquery "queryname" in the button's OnClick event
 
B

Barkley

Hi...

I was wondering if someone could walk me through the procedure for running a
query off a form... I have been going through the search engine and have
posted a couple threads as I have been hunting and pecking for information
that pertain to what I am doing but am still coming up empty-handed...

I think once I have the basics down I can go from there on my own...

In its most basicsense, this is what I am trying to do...

I want a form with a command button that will run a query... the query doesnt
have to appear as anything special, just a plain old select query showing
tabular results... so when I open the form and click the button, the query
will run... can someone please tell me how to do that... I know it probably
sounds incredibly basic, but for the life of me, I can't find the information
I require to cover whatever steps are needed to do that... any thoughts would
be appreciated...

Thanks, Barkley
 
F

fredg

Hi...

I was wondering if someone could walk me through the procedure for running a
query off a form... I have been going through the search engine and have
posted a couple threads as I have been hunting and pecking for information
that pertain to what I am doing but am still coming up empty-handed...

I think once I have the basics down I can go from there on my own...

In its most basicsense, this is what I am trying to do...

I want a form with a command button that will run a query... the query doesnt
have to appear as anything special, just a plain old select query showing
tabular results... so when I open the form and click the button, the query
will run... can someone please tell me how to do that... I know it probably
sounds incredibly basic, but for the life of me, I can't find the information
I require to cover whatever steps are needed to do that... any thoughts would
be appreciated...

Thanks, Barkley

Add a command button to your form.
Code it's Click event:
DoCmd.OpenQuery "TheQueryName"

To make it even simpler, before you add the command button, make sure
the Command Button Wizard is pressed (the button with the wand and
falling stars).
Select Miscellaneous + Run Query and follow the wizard's instructions.
It will write the code for you.
 

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