Share via

Create a Command Button that will run a query when clicked.

Anonymous
2010-12-09T01:06:41+00:00

I have created a Command Button that when clicked needs to run a query.  In the code I can DoCmd.requery, but I can't get it to identify which Query I want to run.

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2010-12-09T01:11:38+00:00

Oops, forgot to add if an Action query then

DoCmd.SetWarnings False

DoCmd.OpenQuery "PutYourQueryHere"

DoCmd.SetWarnings True


--

Gina Whipp

2010 Microsoft MVP (Access)

Please post all replies to the forum where everyone can benefit.

Was this answer helpful?

6 people found this answer helpful.
0 comments No comments

3 additional answers

Sort by: Most helpful
  1. Anonymous
    2010-12-09T04:13:20+00:00

    You're welcome!


    --

    Gina Whipp

    2010 Microsoft MVP (Access)

    Please post all replies to the forum where everyone can benefit.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2010-12-09T03:17:09+00:00

    Thanks alot, it works great.

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2010-12-09T01:09:27+00:00

    Requery only requeries the current recordsource of the form.  What you want is....

    DoCmd.OpenQuery "PutYourQueryHere"


    --

    Gina Whipp

    2010 Microsoft MVP (Access)

    Please post all replies to the forum where everyone can benefit.

    Was this answer helpful?

    0 comments No comments