Access to Queries

whitestone

Usually Confused
Local time
Today, 08:17
Joined
Oct 29, 2002
Messages
35
Hello All,

I may not explain this very well.

I have a database where I want the user to be able to run queries but not have access to the database window from the form which they can see. I have set up a button that opens a blank query but wnat them to have access to a list of past queries....any suggestions.

Ben
 
Ben,

Behind a command button's On Click event, you can put code like this:

DoCmd.OpenQuery "TheNameOfYourSavedQuery"

That line will open SELECT and Crosstab queries. If you want to run an ACTION query (one that alters data in a table -- such as a DELETE query) at the click of a button, then you can put code like this:

DoCMD.RUNSQL "SQL code goes here."

Don't know SQL syntax? Then switch to SQL view when designing your query with Access and copy and paste. There are examples in HELP (at least in Access 2000) for both of these commands and a fair amount of posts here if you need to dig deeper.

Regards,
Tim
 

Users who are viewing this thread

Back
Top Bottom