How to assign query to command button of a form

BizBoy

Board Regular
Joined
Jul 26, 2012
Messages
118
Hi,
I do not have any idea about forms.
My post might be wrong. I apologize in advance for the same.

I have a database.
I have written multiple queries for retrieving information from this database.

Now I am trying to design a form, assign a query to command button of the form.
I have bit of VBA experience however I have 0 knowledge about access forms.

Can anyone please guide me about how should I proceed.
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
There are so many hits when googling this that I think you also should just try some searches also.
For instance try googling msaccess run query with command button
 
Upvote 0
select the button , view its properties (F4)
the button has events (events tab of the properties), you want CLICK event,
you can assign a macro from the drop box
in the macro , put in your query OPENQUERY qsMyQuery

so put the query in the macro, save
put the macro in the click event

(a basic Access 'How To' book will tell you all these techniques)
 
Last edited:
Upvote 0
Thanks for the help ranman. I got stuck when I saw macro option.
I was searching for query option.

Now I understood that I need to put query in macro and assign macro to button.

Have a nice day ahead. :)
 
Upvote 0

Forum statistics

Threads
1,214,833
Messages
6,121,868
Members
449,053
Latest member
Mesh

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top